Warning: Can save best model only with val_acc available, skipping
解决keras保存最优模型时出现Warning: Can save best model only with val_acc available, skipping
·
最近在用keras训练模型,在保存最优模型的时候出现
Warning: Can save best model only with val_acc available, skipping
检查了一下代码,发现好像没有什么问题
贴上之前的代码
#要求存储最佳模型
checkpointer = ModelCheckpoint(filepath = path,
monitor = 'val_acc',
mode = 'max',
save_best_only = True,
verbose = 1)
model.fit(x_train, y_train,batch_size = 128,
epochs = 100,validation_data = (x_test, y_test),
shuffle = True,callbacks = [checkpointer])
看半天突然发现一个问题
灵机一动想着是不是参数名字的问题,抱着试试的心态,改成了下列代码
#要求存储最佳模型
checkpointer = ModelCheckpoint(filepath = path,
monitor = 'val_accuracy',
mode = 'max',
save_best_only = True,
verbose = 1)
model.fit(x_train, y_train,batch_size = 128,
epochs = 100,validation_data = (x_test, y_test),
shuffle = True,callbacks = [checkpointer])
运行结果
流下了感动的泪水,突然觉得是自己智障
更多推荐
已为社区贡献1条内容
所有评论(0)