Skip to content

Instantly share code, notes, and snippets.

View JosephKJ's full-sized avatar
🙇‍♂️
Work hard!

Joseph K J JosephKJ

🙇‍♂️
Work hard!
View GitHub Profile
@JosephKJ
JosephKJ / algo.tex
Created May 15, 2021 16:21
Algorithm in Latex
# Add in the preamble
\usepackage{algorithm}
\usepackage[noend]{algpseudocode}
\renewcommand{\algorithmicrequire}{\textbf{Input:}}
\renewcommand{\algorithmicensure}{\textbf{Output:}}
# Content
@JosephKJ
JosephKJ / visualize.py
Created December 24, 2019 14:15
Visualize models trained with Detectron2
import cv2
from detectron2.utils.logger import setup_logger
setup_logger()
from detectron2.config import get_cfg
from detectron2.engine import DefaultPredictor
from detectron2.utils.visualizer import Visualizer
from detectron2.data import MetadataCatalog
# Get image
@JosephKJ
JosephKJ / sieve_images_to_single_folder.py
Created December 14, 2018 11:11
Extract images in different folders to single folder
import os
from shutil import copyfile
train_path = '/DATA1/datasets/ILSVRC2012_img_train/imagenet'
destination_path = '/DATA1/datasets/ILSVRC2012_img_train/imagenet_all_images'
i = 0
for path, dir_name, file_names in os.walk(train_path):
i += 1
'pink primrose'
'hard-leaved pocket orchid'
'canterbury bells'
'sweet pea'
'english marigold'
'tiger lily'
'moon orchid'
'bird of paradise'
'monkshood'
'globe thistle'
@JosephKJ
JosephKJ / bench_rocsgd.py
Created April 13, 2018 10:33 — forked from coreylynch/bench_rocsgd.py
Benchmark sklearn RankSVM implementations (now with sofia binding benchmarks)
import itertools
import numpy as np
from sklearn.linear_model import SGDClassifier, SGDRanking
from sklearn import metrics
from minirank.compat import RankSVM as MinirankSVM
from scipy import stats
@JosephKJ
JosephKJ / convert_to_csv.m
Created October 30, 2017 06:18
Convert Small Object Dataset annotations from mat to csv
% Retrieving the data
data = load('SUN_small_obj_train.mat');
struct_arr = getfield(data, 'SUN_small_obj_train');
% Converting each row to a its corresponding csv
fileID = fopen('SUN_small_obj_train.csv','w');
[nrows,ncols] = size(struct_arr);
for row = 1:nrows
for col = 1:ncols
if isempty(struct_arr{row,col})
@JosephKJ
JosephKJ / VGG_ILSVRC_16_layers_deploy.prototxt
Last active August 16, 2017 05:36
Modified VGG_ILSVRC_16 Architecture, which contains only Convolutional Layers.
# Modified VGG_ILSVRC_16 Architecture, which contains only Convolutional Layers.
# Adapted from: https://gist.github.com/ksimonyan/211839e770f7b538e2d8#file-readme-md
name: "VGG_ILSVRC_16_layers"
input: "data"
input_dim: 10
input_dim: 3
input_dim: 224
input_dim: 224
layers {
name: "VDSR"
layer {
name: "data"
type: "HDF5Data"
top: "data"
top: "label"
hdf5_data_param {
source: "examples/VDSR/train.txt"
batch_size: 64
}