【发布时间】:2020-09-18 08:45:35
【问题描述】:
专家,我是机器学习新手,我是使用 Keras API 和 TensorFlow 后端来训练机器学习模型。我正在使用模型检查点在 .json 和 .h5 文件中独立保存最佳权重和最佳模型。到目前为止,我尝试编写如下代码,但没有保存任何模型或权重。希望我能得到好的解决方案。在此先感谢。
filepath1="best_weights.h5"
filepath2="best_model.json"
checkpoint = ModelCheckpoint(filepath1, monitor='val_acc', verbose=1, save_best_only=True, mode='max')
callbacks_list = [checkpoint]
history = model.fit_generator(train_generator,steps_per_epoch=nb_train_samples // batch_size, epochs=epochs, validation_data=validation_generator, callbacks=callbacks_list, validation_steps=nb_validation_samples // batch_size, verbose=1)
【问题讨论】:
标签: python tensorflow keras deep-learning autoencoder