Lil*_*ilo 6 python conv-neural-network keras tensorflow keras-2
我想使用 Keras ModelCheckpoint 回调来监视多个参数(我有一个多任务网络)。只需要一个回调就可以吗?或者我需要在许多回调中这样做吗?
ckechpoint的创建:
checkpointer = ModelCheckpoint(filepath='checkpoints/weights-{epoch:02d}.hdf5', monitor='val_O1_categorical_accuracy' , verbose=1, save_best_only=True, mode='max')
Run Code Online (Sandbox Code Playgroud)
我要监控的第二个参数:val_O2_categorical_accuracy
在列表中这样做是行不通的。IE
checkpointer = ModelCheckpoint(filepath='checkpoints/weights-{epoch:02d}.hdf5', monitor=['val_O1_categorical_accuracy','val_O2_categorical_accuracy'] , verbose=1, save_best_only=True, mode='max')
Run Code Online (Sandbox Code Playgroud)
类型错误:不可散列的类型:“列表”
恐怕您将不得不在不同的情况下执行此操作。想想这里发生了什么——
checkpointer = ModelCheckpoint(filepath='checkpoints/weights-{epoch:02d}.hdf5', monitor='val_O1_categorical_accuracy' , verbose=1, save_best_only=True, mode='max')
Run Code Online (Sandbox Code Playgroud)
当您通过监视保存模型时val_O1_categorical_accuracy
,它将在伪代码中执行以下操作 -
for each epoch:
check the val_O1_categorical_accuracy after updating weights
if this metric is better in this epoch than the previous ones:
save the model
else
pass
Run Code Online (Sandbox Code Playgroud)
所以真正指定多个monitor
超出了范围。在这种情况下,它必须是一个非此即彼的选择,因为基于monitor
度量,在其他冲突模型中只有一个模型可能是最好的模型。
归档时间: |
|
查看次数: |
7485 次 |
最近记录: |