Skip to content

Instantly share code, notes, and snippets.

@eileen-code4fun
Created June 14, 2021 14:25
Show Gist options
  • Save eileen-code4fun/5698cd89e91e9ce62d3085760ef80dac to your computer and use it in GitHub Desktop.
Save eileen-code4fun/5698cd89e91e9ce62d3085760ef80dac to your computer and use it in GitHub Desktop.
CIFAR10 Load
import tensorflow as tf
# Load the saved custom model.
model = tf.keras.models.load_model(GCS_PATH_FOR_SAVED_MODEL)
model.compile(optimizer='adam',
loss=tf.keras.losses.SparseCategoricalCrossentropy(from_logits=False),
metrics=['accuracy'])
model.summary()
'''
Output:
Model: "sequential"
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
conv2d (Conv2D) (None, 30, 30, 32) 896
_________________________________________________________________
max_pooling2d (MaxPooling2D) (None, 15, 15, 32) 0
_________________________________________________________________
conv2d_1 (Conv2D) (None, 13, 13, 64) 18496
_________________________________________________________________
max_pooling2d_1 (MaxPooling2 (None, 6, 6, 64) 0
_________________________________________________________________
conv2d_2 (Conv2D) (None, 4, 4, 64) 36928
_________________________________________________________________
flatten (Flatten) (None, 1024) 0
_________________________________________________________________
dropout (Dropout) (None, 1024) 0
_________________________________________________________________
dense (Dense) (None, 64) 65600
_________________________________________________________________
dense_1 (Dense) (None, 10) 650
=================================================================
Total params: 122,570
Trainable params: 122,570
Non-trainable params: 0
'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment