Created
April 29, 2020 03:32
-
-
Save sayakpaul/55ad8e3e4331b580c079d7d771038acd to your computer and use it in GitHub Desktop.
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
# Load the MobileNetV2 model but exclude the classification layers | |
EXTRACTOR = MobileNetV2(weights='imagenet', include_top=False, | |
input_shape=(224, 224, 3)) | |
# We are fine-tuning | |
EXTRACTOR.trainable = True | |
# Construct the head of the model that will be placed on top of the | |
# the base model | |
class_head = EXTRACTOR.output | |
class_head = GlobalAveragePooling2D()(class_head) | |
class_head = Dense(512, activation="relu")(class_head) | |
class_head = Dropout(0.5)(class_head) | |
class_head = Dense(1)(class_head) | |
# Create the new model | |
pet_classifier = Model(inputs=EXTRACTOR.input, outputs=class_head) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment