Last active
October 26, 2021 10:42
-
-
Save thuwarakeshm/e2c91dabebcbb9a1447a2bf7a19e2e4c to your computer and use it in GitHub Desktop.
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
| # trainable property is available on model instances | |
| model.trainable = False | |
| # Also on individual layers | |
| layer.trainable = False |
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
| tf.keras.layers.Dense(8, activation='relu')(input1) |
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
| model = VGG16( | |
| include_top=False, | |
| # Other model parameters | |
| ) |
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
| # Specify a small value for learning rate. | |
| # This ensures the model doesn't drastically deviate from the original one. | |
| base_learning_rate = 0.0001 | |
| model.compile( | |
| optimizer=tf.keras.optimizers.Adam(learning_rate=base_learning_rate), | |
| loss=tf.keras.losses.BinaryCrossentropy(from_logits=True), | |
| metrics=['accuracy'] | |
| ) | |
| training_history = model.fit( | |
| train_dataset, | |
| epochs=initial_epochs, | |
| validation_data=validation_dataset | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment