Skip to content

Instantly share code, notes, and snippets.

@jkmackie
Last active October 1, 2022 05:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jkmackie/f6606db13078c6f9bbcd86ee079d3242 to your computer and use it in GitHub Desktop.
Save jkmackie/f6606db13078c6f9bbcd86ee079d3242 to your computer and use it in GitHub Desktop.
#Add classification layers.
from tensorflow.keras import layers, models
flatten_layer = layers.Flatten()
dense_layer_1 = layers.Dense(10, activation='relu')
dropout_1 = layers.Dropout(rate=0.3)
prediction_layer = layers.Dense(1, activation='sigmoid') #sigmoid for binary activation
#Transfer learning - base_model plus classifcation layers.
model = models.Sequential([
base_model,
flatten_layer,
dense_layer_1,
dropout_1,
prediction_layer,
])
model.summary()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment