Skip to content

Instantly share code, notes, and snippets.

View yshean's full-sized avatar

Yong Shean yshean

  • Comerge Solutions
  • Kuala Lumpur, Malaysia
  • X @shin_chong
View GitHub Profile
@yshean
yshean / shear_and_rotate.py
Created April 27, 2017 07:09
Data augmentation using shear and rotate within a range.
def shear_and_rotate(image_path, img_w, img_h):
from skimage.io import imread, imsave
from skimage.transform import resize
from skimage import transform as transf
import numpy as np
from skimage.filters import threshold_otsu
from scipy.ndimage.interpolation import rotate
import math
image = imread(image_path)
@yshean
yshean / keras_ae.py
Created December 17, 2015 12:49
Keras with Theano backend: This is a working example of autoencoder training on MNIST dataset.
n_in = 784
n_hid = 392
n_out = n_in
batch_size = 64
nb_epoch = 10
learning_rate = 1e-3
from keras.datasets import mnist
import numpy as np
(X_train, y_train), (X_test, y_test) = mnist.load_data()
@yshean
yshean / load-test.sh
Last active August 29, 2015 14:25
Load testing dataset for slice 1_01
#!/bin/bash
# This is an example of loading test dataset for slice 1_01
# This will serve as a template for loading test dataset for other slices
# Require load-images-test.lua to be hosted on S3
# After this run load-test-slice.sh for each of the other slices
slice='1_01'
cd ~/demos/load-data