更新时间:2023-12-01 21:40:52
Keras具有CSVLogger回调,该回调似乎完全可以满足您的需要;从文档:
Keras has the CSVLogger callback which appears to do exactly what you need; from the documentation:
将纪元结果流式传输到CSV文件的回调.
Callback that streams epoch results to a CSV file.
它具有用于添加到文件的附加参数.再次,从文档中:
It has an append parameter for adding to the file. Again, from the documentation:
追加:布尔值.True:如果文件存在,则追加(用于继续培训).False:覆盖现有文件
append: Boolean. True: append if file exists (useful for continuing training). False: overwrite existing file
来自keras.callbacks的
from keras.callbacks import CSVLogger
csv_logger = CSVLogger("model_history_log.csv", append=True)
model.fit_generator(...,callbacks=[csv_logger])