Created
June 16, 2016 09:57
-
-
Save isseu/8f4fe33c43c5e83443a1cae7fc3e69e2 to your computer and use it in GitHub Desktop.
Only the construction part, squeezenet with tflearn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self.network = input_data(shape = [None, SIZE_FACE, SIZE_FACE, 1]) | |
self.network = conv_2d(self.network, 96, 3, strides = 3, activation = 'relu') | |
self.network = max_pool_2d(self.network, 3, strides = 2) | |
# Fire 1 | |
fire2_squeeze = conv_2d(self.network, 16, 1, activation = 'relu') | |
fire2_expand1 = conv_2d(fire2_squeeze, 64, 1, activation = 'relu') | |
fire2_expand2 = conv_2d(fire2_squeeze, 64, 3, activation = 'relu') | |
self.network = merge([fire2_expand1, fire2_expand2], mode = 'concat', axis = 1) | |
# Fire 2 | |
fire3_squeeze = conv_2d(self.network, 16, 1, activation = 'relu') | |
fire3_expand1 = conv_2d(fire3_squeeze, 64, 1, activation = 'relu') | |
fire3_expand2 = conv_2d(fire3_squeeze, 64, 3, activation = 'relu') | |
self.network = merge([fire3_expand1, fire3_expand2], mode = 'concat', axis = 1) | |
# Fire 3 | |
fire4_squeeze = conv_2d(self.network, 32, 1, activation = 'relu') | |
fire4_expand1 = conv_2d(fire4_squeeze, 128, 1, activation = 'relu') | |
fire4_expand2 = conv_2d(fire4_squeeze, 128, 3, activation = 'relu') | |
self.network = merge([fire2_expand1, fire2_expand2], mode = 'concat', axis = 1) | |
# MaxPool 4 | |
self.network = max_pool_2d(self.network, 2) | |
# Fire 5 | |
fire5_squeeze = conv_2d(self.network, 32, 1, activation = 'relu') | |
fire5_expand1 = conv_2d(fire5_squeeze, 128, 1, activation = 'relu') | |
fire5_expand2 = conv_2d(fire5_squeeze, 128, 3, activation = 'relu') | |
self.network = merge([fire2_expand1, fire2_expand2], mode = 'concat', axis = 1) | |
# Fire 6 | |
fire6_squeeze = conv_2d(self.network, 48, 1, activation = 'relu') | |
fire6_expand1 = conv_2d(fire6_squeeze, 192, 1, activation = 'relu') | |
fire6_expand2 = conv_2d(fire6_squeeze, 192, 3, activation = 'relu') | |
self.network = merge([fire6_expand1, fire6_expand2], mode = 'concat', axis = 1) | |
# Fire 7 | |
fire7_squeeze = conv_2d(self.network, 48, 1, activation = 'relu') | |
fire7_expand1 = conv_2d(fire7_squeeze, 192, 1, activation = 'relu') | |
fire7_expand2 = conv_2d(fire7_squeeze, 192, 3, activation = 'relu') | |
self.network = merge([fire7_expand1, fire7_expand2], mode = 'concat', axis = 1) | |
# Fire 8 | |
fire8_squeeze = conv_2d(self.network, 64, 1, activation = 'relu') | |
fire8_expand1 = conv_2d(fire8_squeeze, 256, 1, activation = 'relu') | |
fire8_expand2 = conv_2d(fire8_squeeze, 256, 3, activation = 'relu') | |
self.network = merge([fire8_expand1, fire8_expand2], mode = 'concat', axis = 1) | |
# MaxPool 8 | |
self.network = max_pool_2d(self.network, 2) | |
# Fire 9 | |
fire9_squeeze = conv_2d(self.network, 64, 1, activation = 'relu') | |
fire9_expand1 = conv_2d(fire9_squeeze, 256, 1, activation = 'relu') | |
fire9_expand2 = conv_2d(fire9_squeeze, 256, 3, activation = 'relu') | |
self.network = merge([fire9_expand1, fire9_expand2], mode = 'concat', axis = 1) | |
self.network = dropout(self.network, 0.5) | |
# Conv10 | |
self.network = conv_2d(self.network, 10, 1, activation = 'relu', padding = 'valid') | |
# AVG 1 | |
self.network = avg_pool_2d(self.network, 3) # LOL | |
self.network = flatten(self.network) | |
self.network = fully_connected(self.network, len(EMOTIONS), activation = 'softmax') | |
self.network = regression(self.network, | |
optimizer = 'momentum', | |
loss = 'categorical_crossentropy') | |
self.model = tflearn.DNN( | |
self.network, | |
checkpoint_path = SAVE_DIRECTORY + '/alexnet_mood_recognition', | |
max_checkpoints = 1, | |
tensorboard_verbose = 2 | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
why the axis in merge axis = 1. It should be axis = 3 right?. concat along the feature maps.
rchip