From b61ecf090ad3cdb3383039522fb0f0db3edf3b92 Mon Sep 17 00:00:00 2001 From: Connor Date: Mon, 8 Aug 2016 23:57:20 -0700 Subject: [PATCH 1/4] --- .dummy | 1 + 1 file changed, 1 insertion(+) create mode 100644 .dummy diff --git a/.dummy b/.dummy new file mode 100644 index 0000000..945c9b4 --- /dev/null +++ b/.dummy @@ -0,0 +1 @@ +. \ No newline at end of file From e02bca097cf41f6977a463ec87691e782da03e7f Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Tue, 9 Aug 2016 01:11:05 -0700 Subject: [PATCH 2/4] . --- .dummy | 1 - resnet-1470729826.pkl | Bin 0 -> 25601 bytes resnet.py | 178 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 178 insertions(+), 1 deletion(-) delete mode 100644 .dummy create mode 100755 resnet-1470729826.pkl create mode 100755 resnet.py diff --git a/.dummy b/.dummy deleted file mode 100644 index 945c9b4..0000000 --- a/.dummy +++ /dev/null @@ -1 +0,0 @@ -. \ No newline at end of file diff --git a/resnet-1470729826.pkl b/resnet-1470729826.pkl new file mode 100755 index 0000000000000000000000000000000000000000..a39d212aa67e501bd42f217ac03c643452d253ce GIT binary patch literal 25601 zcmY(K2{e_@|G(u5Sn&CB1x@%JxkCP2VH@rQ zZ3}*F3sDPx3lR$uSFXr^uXl1iab&kRS9FsAA0OWyJ+7Dqp9Q}^SKNj>QQJar6aV;6 z8Lottm6iGL@vpz%EcjfxlNrd=Rd_Q3)kE7ga?FA6|VVJCc_ zdt`+n`bS5B zazG-Hi+)Kucedb5ZrNbRgCH1Fs0&91;(1*n@nmelIvK}#TuIys4?AvVe^yVP(1fk&h&N?tQMIUbZWC9nf$wB0#3uo8c z!*jo8!)=CX@Q`ped}^2lcjPxf;|wu4GW$8$eMA;#z-FZ=%{c26DlH-Z~J{8vUa35%w9tQ5|YIyw) zb<*^!47l$NgZ7b1=;FPFD5BCALP-wOxOgi37$A&Z+!&!@QDE{W`2P|yBeBndxm z><4t;V_-cN$Ub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A3i@)0@HILIfY+R9gjV7csynpwV`K}I@b&ZRZb<;_esdRWxwWU|tJ?C~LTx7v=2RnoRjAtY+DtW; z8YJpS%hR&WeR;-9g^TT(hm^s~@zMznlL+=J@TF?7D81tn;=S+1n7AT-BBL zRI9r2+CsIK26L(nzbaI=yf#zqqy~w4cGbc>OOGY8E+La~?TXQ|?z>I$YV>Nb@!SFvh0Vmmb|TZw(K{v zblLibeA&<9i!zlH@2OTf^V&k~B@O0O7k*W!dh^;$b(I<<>K7L$c%|9TX6fkV%^M}h zRReeAJsI>1cXAq&H=v)JOx1_?RIB>(+CuFo4dzrgepRUY^V&=uAT>zT{L1O_67_ib zt%G**mop~G7r!-@) zQ?b+_Q7`wF01&rySyRsADO*!v^>3)k=%GmgG>`WM6QzYo@$kx*I9G={15iF Bk(dAg literal 0 HcmV?d00001 diff --git a/resnet.py b/resnet.py new file mode 100755 index 0000000..d9825b7 --- /dev/null +++ b/resnet.py @@ -0,0 +1,178 @@ +import pickle, time +import sys +import numpy as np +from keras.callbacks import LearningRateScheduler +from keras.datasets import mnist +from keras.layers import BatchNormalization +from keras.layers import Convolution2D, MaxPooling2D +from keras.layers import Flatten, Reshape +from keras.layers import Input, merge, Dense, Activation, Dropout +from keras.models import Model +from keras.utils.np_utils import to_categorical + +nb_classes = 10 +width = 28 +height = 28 +loss='categorical_crossentropy' + +name = 'resnet-{:.0f}'.format(time.time()) + +args = dict(enumerate(sys.argv)) +restore_fn = args.get(1) +if restore_fn == '.': # TODO: accept any directory + # just use most recent resnet-*.pkl file in directory + import os + is_valid = lambda fn: fn.startswith('resnet-') and fn.endswith('.pkl') + files = sorted([fn for fn in os.listdir(restore_fn) if is_valid(fn)]) + if len(files) == 0: + raise Exception("couldn't find any appropriate .pkl files in the CWD") + restore_fn = files[-1] + +dont_train = False +verbose_summary = False + +reslayers = 4 +size = 8 + +batch_size = 128 +epochs = 24 +convolutional = True +resnet_enabled = True +original_resnet = False +LR = 1e-2 +LRprod = 0.1**(1/20.) # will use a tenth of the learning rate after 20 epochs + +use_image_generator = True + +# the data, shuffled and split between train and test sets +(X_train, y_train), (X_test, y_test) = mnist.load_data() +X_train = X_train.reshape(X_train.shape[0], 1, width, height) +X_test = X_test.reshape(X_test.shape[0], 1, width, height) +X_train = X_train.astype('float32') / 255 +X_test = X_test.astype('float32') / 255 +# convert class vectors to binary class matrices +Y_train = to_categorical(y_train, nb_classes) +Y_test = to_categorical(y_test, nb_classes) + +if use_image_generator: + from keras.preprocessing.image import ImageDataGenerator + idg = ImageDataGenerator(rotation_range=5., + width_shift_range=.10, + height_shift_range=.10, + shear_range=5 / 180 * np.pi, + zoom_range=0.1, + fill_mode='constant', + cval=0.) + +# ReLU activation is supposed to be the best with he_normal +if convolutional: + layer = lambda x: Convolution2D(x, 3, 3, init='he_normal', border_mode='same') +else: + layer = lambda x: Dense(x, init='he_normal') + +# start construting the model +x = Input(shape=(1, width, height)) +y = x + +if convolutional: + # it might be worth trying other sizes here + y = Convolution2D(size, 7, 7, subsample=(2, 2), border_mode='same')(y) + y = MaxPooling2D()(y) +else: + y = Flatten()(y) + y = Dense(dense_size)(y) + +for i in range(reslayers): + skip = y + if original_resnet: + y = layer(size)(y) + y = BatchNormalization(axis=1)(y) + y = Activation('relu')(y) + y = layer(size)(y) + y = BatchNormalization(axis=1)(y) + if resnet_enabled: y = merge([skip, y], mode='sum') + y = Activation('relu')(y) + else: + y = BatchNormalization(axis=1)(y) + y = Activation('relu')(y) + y = layer(size)(y) + y = BatchNormalization(axis=1)(y) + y = Activation('relu')(y) + y = layer(size)(y) + if resnet_enabled: y = merge([skip, y], mode='sum') + +if convolutional: + from keras.layers import AveragePooling1D + y = Reshape((size, int(width * height / 2**2 / 2**2)))(y) + y = AveragePooling1D(size)(y) + y = Flatten()(y) + +y = Dense(nb_classes)(y) +y = Activation('softmax')(y) + +model = Model(input=x, output=y) + +if verbose_summary: + model.summary() +else: + total_params = 0 + for layer in model.layers: + total_params += layer.count_params() + print("Total params: {}".format(total_params)) + +if restore_fn: + with open(restore_fn, 'rb') as f: + W = pickle.loads(f.read()) + if not dont_train: + # sparsify an existing model + for i, w in enumerate(W): + if w.shape == (size, size, 3, 3): + middle = np.median(np.abs(w.flat)) + where = np.abs(w) < middle + total = np.prod(w.shape) + fmt = 'W[{}]: zeroing {} params of {}' + print(fmt.format(i, int(np.count_nonzero(where)), int(total))) + W[i] = np.where(where, 0, w) + model.set_weights(W) + LR /= 10 + +model.compile(loss=loss, optimizer='adam', metrics=['accuracy']) + +if not dont_train: + callbacks = [LearningRateScheduler(lambda e: LR * LRprod**e)] + + kwargs = dict( + nb_epoch=epochs, + validation_data=(X_test, Y_test), + callbacks=callbacks, + verbose=1 + ) + + if use_image_generator: + history = model.fit_generator(idg.flow(X_train, Y_train, batch_size=batch_size), + samples_per_epoch=len(X_train), **kwargs) + else: + history = model.fit(X_train, Y_train, batch_size=batch_size, + **kwargs) + +def evaluate(X, Y): + score = model.evaluate(X, Y, verbose=0) + for name, score in zip(model.metrics_names, score): + if name == "acc": + print("{:7} {:6.2f}%".format(name, score * 100)) + else: + print("{:7} {:7.5f}".format(name, score)) + +print('TRAIN') +evaluate(X_train, Y_train) + +print('TEST') +evaluate(X_test, Y_test) + +print('ALL') +evaluate(np.vstack((X_train, X_test)), np.vstack((Y_train, Y_test))) + +if not dont_train: + open(name+'.json', 'w').write(model.to_json()) + with open(name+'.pkl', 'wb') as f: + f.write(pickle.dumps(model.get_weights())) From 15d053789e2fc62ea3bbfce64dd044b3503bb16a Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Thu, 5 Jan 2017 04:55:10 -0800 Subject: [PATCH 3/4] . --- resnet-1470729826.pkl | Bin resnet.py | 22 ++++++++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) mode change 100755 => 100644 resnet-1470729826.pkl diff --git a/resnet-1470729826.pkl b/resnet-1470729826.pkl old mode 100755 new mode 100644 diff --git a/resnet.py b/resnet.py index d9825b7..1e4585f 100755 --- a/resnet.py +++ b/resnet.py @@ -1,3 +1,8 @@ +#!/usr/bin/env python3 + +import keras.backend as K +assert K.image_dim_ordering() == 'th' + import pickle, time import sys import numpy as np @@ -6,7 +11,7 @@ from keras.datasets import mnist from keras.layers import BatchNormalization from keras.layers import Convolution2D, MaxPooling2D from keras.layers import Flatten, Reshape -from keras.layers import Input, merge, Dense, Activation, Dropout +from keras.layers import Input, merge, Dense, Activation from keras.models import Model from keras.utils.np_utils import to_categorical @@ -44,15 +49,16 @@ LRprod = 0.1**(1/20.) # will use a tenth of the learning rate after 20 epochs use_image_generator = True +def prepare(X, y): + X = X.reshape(X.shape[0], 1, width, height).astype('float32') / 255 + # convert class vectors to binary class matrices + Y = to_categorical(y_train, nb_classes) + return X, Y + # the data, shuffled and split between train and test sets (X_train, y_train), (X_test, y_test) = mnist.load_data() -X_train = X_train.reshape(X_train.shape[0], 1, width, height) -X_test = X_test.reshape(X_test.shape[0], 1, width, height) -X_train = X_train.astype('float32') / 255 -X_test = X_test.astype('float32') / 255 -# convert class vectors to binary class matrices -Y_train = to_categorical(y_train, nb_classes) -Y_test = to_categorical(y_test, nb_classes) +X_train, Y_train = prepare(X_train, y_train) +X_test, Y_test = prepare(X_test, y_test) if use_image_generator: from keras.preprocessing.image import ImageDataGenerator From f7e3cfceb1932d41e628969060200804fc50c271 Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Thu, 5 Jan 2017 04:56:35 -0800 Subject: [PATCH 4/4] . --- resnet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resnet.py b/resnet.py index 1e4585f..bd90b32 100755 --- a/resnet.py +++ b/resnet.py @@ -52,7 +52,7 @@ use_image_generator = True def prepare(X, y): X = X.reshape(X.shape[0], 1, width, height).astype('float32') / 255 # convert class vectors to binary class matrices - Y = to_categorical(y_train, nb_classes) + Y = to_categorical(y, nb_classes) return X, Y # the data, shuffled and split between train and test sets