Skip to content

Instantly share code, notes, and snippets.

View hma02's full-sized avatar

He Ma hma02

  • University of Guelph
  • Canada
View GitHub Profile
@hma02
hma02 / adjust_srt.py
Last active April 4, 2017 15:42
Adjust movie SRT based on two timestamps
import pysrt
def srt_shift(shift, scale, input_file, output_file):
## the input srt file should be in utf-8 encoding
subs = pysrt.open(input_file)
print len(subs)
@hma02
hma02 / cifar10_wide_resnet.py
Created February 3, 2017 18:15 — forked from kashif/cifar10_wide_resnet.py
Keras Wide Residual Networks CIFAR-10
from __future__ import print_function
from keras.datasets import cifar10
from keras.layers import merge, Input
from keras.layers.convolutional import Convolution2D, ZeroPadding2D, AveragePooling2D
from keras.layers.core import Dense, Activation, Flatten, Dropout
from keras.layers.normalization import BatchNormalization
from keras.models import Model
from keras.preprocessing.image import ImageDataGenerator
from keras.utils import np_utils
@hma02
hma02 / gist:35cc44e5b17750453b1f
Created March 17, 2016 03:10 — forked from benanne/gist:ae2a7adaab133c61a059
Inception module in Lasagne (without 3x3s1 pooling)
import lasagne as nn
Conv2DLayer = nn.layers.Conv2DDNNLayer
def inception_module(l_in, num_1x1, reduce_3x3, num_3x3, reduce_5x5, num_5x5, gain=1.0, bias=0.1):
"""
inception module (without the 3x3s1 pooling and projection because that's difficult in Theano right now)
"""
shape = l_in.get_output_shape()
out_layers = []