tensorflow2 keras.Callback logs

官方文档上表示logs内存的内容为

on_epoch_end: logs include `acc` and `loss`, and
    optionally include `val_loss`
    (if validation is enabled in `fit`), and `val_acc`
    (if validation and accuracy monitoring are enabled).
on_batch_begin: logs include `size`,
    the number of samples in the current batch.
on_batch_end: logs include `loss`, and optionally `acc`
    (if accuracy monitoring is enabled).

即存字典关键字为acc,loss跟val_loss与val_acc。但是在执行回调使用这些关键字时会报找不到此关键字的错。debug发现,logs里存的关键词应该为accuracy,loss,val_loss,跟val_accuracy。

换成这些关键词就可以。

原文地址:https://www.cnblogs.com/lolybj/p/11636754.html