## 마지막으로 저장된 checkpoint 불러오기
latest = tf.train.latest_checkpoint(checkpoint_dir)
# Create a new model instance
new_model = create_model2()
new_model.compile(optimizer=keras.optimizers.Adam(learning_rate),
loss='categorical_crossentropy',
metrics=['accuracy'])
# Before loading weights
new_model.evaluate(test_dataset)
# Load the previously saved weights
new_model.load_weights(latest)
# Re-evaluate the model
new_model.evaluate(test_dataset)
## HDF5 format으로 전체 model 저장하기
save_dir_name = 'saved_models'
os.makedirs(save_dir_name, exist_ok=True)
hdf5_model_path = os.path.join(cur_dir, save_dir_name, 'my_model.h5')