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是正確的
添加回答
舉報