Skip to content

Instantly share code, notes, and snippets.

@frakw
frakw / dragbench_good_drag.py
Last active June 29, 2025 18:50
Benchmarking GoodDrag on DragBench dataset
# GoodDrag: https://github.com/zewei-Zhang/GoodDrag
# DragBench: https://github.com/Yujun-Shi/DragDiffusion/releases/tag/v0.1.1
# Usage: python dragbench_goodrag.py [dataset_folder]
# Note: you should use extract_drag_bench.py first, link: https://gist.github.com/frakw/4a259ece6e8a506057ebbbddc2ad5a73
# *************************************************************************
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
@frakw
frakw / extract_drag_bench.py
Created June 13, 2025 06:46
extract DragBench dataset pkl file into drag_instruction.json and mask.png
# usage: python extract_drag_bench.py [drag_bench_data_path]
import sys
import json
import os
import pickle
from PIL import Image
import numpy as np
@frakw
frakw / docker-compose.yaml
Created October 7, 2024 09:53
RegionDrag docker compose file
services:
region_drag:
stdin_open: true
tty: true
devices:
- /dev/dri
group_add:
- video
volumes:
- /tmp/.X11-unix:/tmp/.X11-unix
@frakw
frakw / labelme_gen_mask_img.py
Created December 4, 2023 18:54
Convert all labelme generated json into mask image in every subdirectory
# Author : frakw
# Date : 2023-12-04
# Description : Convert all labelme generated json into mask image in every subdirectory
# Usage : python labelme_gen_mask_img.py
import json
import numpy as np
import cv2
import os
import fnmatch
@frakw
frakw / april_6x6_80x80cm.yaml
Created August 15, 2023 08:03
Camer IMU Calibratoion Resources
target_type: 'aprilgrid' #gridtype
tagCols: 6 #number of apriltags
tagRows: 6 #number of apriltags
tagSize: 0.03 #size of apriltag, edge to edge [m]
tagSpacing: 0.3 #ratio of space between tags to tagSize
codeOffset: 0 #code offset for the first tag in the aprilboard
@frakw
frakw / imgui_glad_glfw.cpp
Last active May 8, 2023 16:28
example code for test imgui using glad and glfw
#include "imgui/imgui.h"
#include "imgui/imgui_impl_glfw.h"
#include "imgui/imgui_impl_opengl3.h"
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <iostream>
#include <string>
int main(void)
{
@frakw
frakw / HW1_B10815057.cpp
Created November 6, 2021 17:35
彩色影像處理作業1 B10815057 廖聖郝
#include <iostream>
#include <string>
#include <random>
#include <fstream>
#include <algorithm>
#include <time.h>
#include <chrono>
#include <limits>
#include <opencv2/opencv.hpp>
#define CVPLOT_HEADER_ONLY
@frakw
frakw / HgtReader.cs
Last active November 2, 2021 18:27
unity 讀取 hgt檔 hgt file reader
using System.Collections;
using System.Collections.Generic;
using System;
using System.IO;
using System.Text;
using UnityEngine;
[System.Serializable]
public class EarthCoord
{
#include <string>
#include <set>
#include <iostream>
#include <iterator>
using namespace std;
#define MAX_ARRAY_SIZE 299983//list陣列大小,用質數可以減少碰撞
//參考自:https://stackoverflow.com/questions/7666509/hash-function-for-string
unsigned int djb2(string& word) {//hash function
@frakw
frakw / word_checker.cpp
Created December 29, 2020 16:03
HOMEWORK 5-1
#include <fstream>
#include <string>
#include <set>
#include <iostream>
#include <numeric>
#include <unordered_map>
#include <iterator>
#include <chrono>
#include <sstream>
using namespace std;