加载CNN保存模型
代码:
from tensorflow.keras.models import load_model
new_model = load_model('./mnist_model/final_CNN_model.h5')
new_model.summary()
输出:
Layer (type) Output Shape Param #
conv2d (Conv2D) (None, 28, 28, 32) 832
max_pooling2d (MaxPooling2D) (None, 14, 14, 32) 0
conv2d_1 (Conv2D) (None, 14, 14, 64) 18496
max_pooling2d_1 (MaxPooling2 (None, 7, 7, 64) 0
dropout (Dropout) (None, 7, 7, 64) 0
flatten (Flatten) (None, 3136) 0
dense_4 (Dense) (None, 128) 401536
dropout_1 (Dropout) (None, 128) 0
dense_5 (Dense) (None, 10) 1290
Total params: 422,154
Trainable params: 422,154
Non-trainable params: 0