Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Only the construction part, squeezenet with tflearn
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
)
@pribadihcr

This comment has been minimized.

Copy link

@pribadihcr pribadihcr commented Nov 23, 2016

why the axis in merge axis = 1. It should be axis = 3 right?. concat along the feature maps.

rchip

@aguang1201

This comment has been minimized.

Copy link

@aguang1201 aguang1201 commented Feb 12, 2017

axis = 3 is right

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment