Created
February 19, 2021 23:50
-
-
Save obeshor/b256919179fe90bf55f7b8a67260bc76 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
from tensorflow.keras import layers | |
from tensorflow.keras import Model | |
!wget --no-check-certificate \ | |
https://storage.googleapis.com/mledu-datasets/inception_v3_weights_tf_dim_ordering_tf_kernels_notop.h5 \ | |
-O /tmp/inception_v3_weights_tf_dim_ordering_tf_kernels_notop.h5 | |
from tensorflow.keras.applications.inception_v3 import InceptionV3 | |
local_weights_file = '/tmp/inception_v3_weights_tf_dim_ordering_tf_kernels_notop.h5' | |
pre_trained_model = InceptionV3(input_shape = (150, 150, 3), | |
include_top = False, | |
weights = None) | |
pre_trained_model.load_weights(local_weights_file) | |
for layer in pre_trained_model.layers: | |
layer.trainable = False | |
pre_trained_model.summary() | |
last_layer = pre_trained_model.get_layer('mixed7') | |
print('last layer output shape: ', last_layer.output_shape) | |
last_output = last_layer.output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment