Skip to content

Commit

Permalink
add mobilenet
Browse files Browse the repository at this point in the history
  • Loading branch information
TropComplique committed Aug 14, 2017
1 parent 936f6f4 commit 188d11b
Show file tree
Hide file tree
Showing 9 changed files with 1,696 additions and 573 deletions.
20 changes: 9 additions & 11 deletions get_logits_from_xception.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"399it [03:53, 1.70it/s]"
"399it [04:04, 1.63it/s]"
]
}
],
Expand Down Expand Up @@ -155,16 +155,14 @@
"text": [
"\n",
"0it [00:00, ?it/s]\u001b[A\n",
"1it [00:00, 1.71it/s]\u001b[A\n",
"2it [00:01, 1.71it/s]\u001b[A\n",
"3it [00:01, 1.71it/s]\u001b[A\n",
"4it [00:02, 1.71it/s]\u001b[A\n",
"5it [00:02, 1.71it/s]\u001b[A\n",
"6it [00:03, 1.71it/s]\u001b[A\n",
"7it [00:04, 1.71it/s]\u001b[A\n",
"8it [00:04, 1.71it/s]\u001b[A\n",
"9it [00:05, 1.71it/s]\u001b[A\n",
"79it [00:46, 1.70it/s]"
"1it [00:00, 1.63it/s]\u001b[A\n",
"2it [00:01, 1.63it/s]\u001b[A\n",
"3it [00:01, 1.63it/s]\u001b[A\n",
"4it [00:02, 1.63it/s]\u001b[A\n",
"5it [00:03, 1.63it/s]\u001b[A\n",
"6it [00:03, 1.63it/s]\u001b[A\n",
"7it [00:04, 1.63it/s]\u001b[A\n",
"79it [00:48, 1.63it/s]"
]
}
],
Expand Down
484 changes: 0 additions & 484 deletions knowledge_distillation.ipynb

This file was deleted.

500 changes: 500 additions & 0 deletions knowledge_distillation_for_mobilenet.ipynb

Large diffs are not rendered by default.

587 changes: 587 additions & 0 deletions knowledge_distillation_for_squeezenet.ipynb

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions mobilenet.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import keras
from keras.applications.mobilenet import MobileNet
from keras.models import Model
from keras.layers import Activation, GlobalAveragePooling2D, Dropout, Dense, Input


def get_mobilenet(input_size, alpha, weight_decay, dropout):
input_shape = (input_size, input_size, 3)
base_model = MobileNet(
include_top=False, weights='imagenet',
input_shape=input_shape, alpha=alpha
)
x = base_model.output
x = GlobalAveragePooling2D()(x)
x = Dropout(dropout)(x)
logits = Dense(256, kernel_regularizer=keras.regularizers.l2(weight_decay))(x)
probabilities = Activation('softmax')(logits)
model = Model(base_model.input, probabilities)

for layer in model.layers[:-2]:
layer.trainable = False

return model
2 changes: 1 addition & 1 deletion squeezenet.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def SqueezeNet(weight_decay, image_size=224):
x = fire_module('6', x, squeeze=48, expand=192) # 13, 13, 384
x = fire_module('7', x, squeeze=48, expand=192) # 13, 13, 384
x = fire_module('8', x, squeeze=64, expand=256) # 13, 13, 512
x = fire_module('9', x, 64, 256, weight_decay, trainable=False) # 13, 13, 512
x = fire_module('9', x, squeeze=64, expand=256) # 13, 13, 512

x = Dropout(0.5)(x)
x = Convolution2D(
Expand Down
178 changes: 140 additions & 38 deletions train_xception.ipynb

Large diffs are not rendered by default.

328 changes: 328 additions & 0 deletions vanilla_mobilenet.ipynb

Large diffs are not rendered by default.

147 changes: 108 additions & 39 deletions vanilla_squeezenet.ipynb

Large diffs are not rendered by default.

0 comments on commit 188d11b

Please sign in to comment.