-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
936f6f4
commit 188d11b
Showing
9 changed files
with
1,696 additions
and
573 deletions.
There are no files selected for viewing
This file contains 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
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
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 |
This file contains 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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.