1 回答
TA贡献1826条经验 获得超6个赞
我得到了它。文件路径名中有错误。我花了很多时间来弄清楚。所以正确的功能是
def get_model_last_epoch(model):
"""
This function should create a new instance of the CNN you created earlier,
load on the weights from the last training epoch, and return this model.
"""
model.load_weights(tf.train.latest_checkpoint('checkpoints_every_epoch'))
return model
def get_model_best_epoch(model):
"""
This function should create a new instance of the CNN you created earlier, load
on the weights leading to the highest validation accuracy, and return this model.
"""
#filepath = tf.train.latest_checkpoint('checkpoints_best_only')
model.load_weights(tf.train.latest_checkpoint('checkpoints_best_only'))
return model
它不会给出错误,因为文件名tf.train.latest_checkpoint是正确的
添加回答
举报