@菜鸟初学keras错误一 20190620

这篇博客记录了一位Keras初学者在使用ModelCheckpoint时遇到的问题,包括如何保存和加载模型,以及遇到的AttributeError。在解决import错误后,作者计划深入学习model.compile()的相关知识,并询问如何将5D tensor转换为4D。
摘要由CSDN通过智能技术生成

@菜鸟初学keras错误一 20190620

记录一下今天的错误

初次使用keras,不知道model.compile,不晓得model.fit,不懂的如何保存checkpoint等模型。
经过一番挣扎后发现,model相关的保存可以通过Modelcheckpoint()来保存

Modelcheckpoint介绍

原版可以看https://www.tensorflow.org/api_docs/python/tf/keras/callbacks/ModelCheckpoint

tf.keras.callbacks.ModelCheckpoint

解释:
Class ModelCheckpoint
Inherits From: Callback

Defined in tensorflow/python/keras/callbacks.py.

Save the model after every epoch.

filepath can contain named formatting options, which will be filled the value of epoch and keys in logs (passed in on_epoch_end).

For example: if filepath is weights.{epoch:02d}-{val_loss:.2f}.hdf5, then the model checkpoints will be saved with the epoch number and the validation loss in the filename.


### Arguments:

 1. filepath: string, path to save the model file.
 
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值