Created
March 21, 2019 13:03
-
-
Save himanshurawlani/65df0462fa4f7dcec8e3faafe42a4b37 to your computer and use it in GitHub Desktop.
Using Keras's Sequential API to add classification head on top of InceptionV3 base model.
This file contains hidden or 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
def build_model(): | |
# Using Sequential API to stack up the layers | |
model = keras.Sequential([ | |
base_model, | |
keras.layers.GlobalAveragePooling2D(), | |
keras.layers.Dense(metadata.features['label'].num_classes, | |
activation='softmax') | |
]) | |
# Compile the model to configure training parameters | |
model.compile(optimizer='adam', | |
loss='sparse_categorical_crossentropy', | |
metrics=['accuracy']) | |
return model | |
inception_model = build_model() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment