Skip to content

Instantly share code, notes, and snippets.

@ozgurshn
Last active June 21, 2018 22:39
Show Gist options
  • Save ozgurshn/6ce21878041a23ca6ed4833c98de33a9 to your computer and use it in GitHub Desktop.
Save ozgurshn/6ce21878041a23ca6ed4833c98de33a9 to your computer and use it in GitHub Desktop.
Resnet50 model fine-tuned
def get_model():
input_tensor = Input(shape=(224, 224, 3)) # this assumes K.image_data_format() == 'channels_last'
# create the base pre-trained model
base_model = ResNet50(input_tensor=input_tensor,weights='imagenet',include_top=False)
for layer in base_model.layers:
layer.trainable=False
x = base_model.output
x = GlobalAveragePooling2D(data_format='channels_last')(x)
x = Dense(num_classes, activation='softmax')(x)
updatedModel = Model(base_model.input, x)
return updatedModel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment