Warning: Can save best model only with val_acc available, skipping

简介: 本文解决了在使用DenseNet网络结构保存最优模型时出现的"Warning: Can save best model only with val_acc available, skipping"问题,方法是将`ModelCheckpoint`回调函数中的`monitor`参数值从`val_acc`改为`val_accuracy`。

Warning: Can save best model only with val_acc available, skipping

今天使用DenseNet网络结构,在保存最优模型的时候出现Warning: Can save best model only with val_acc available, skipping

#回调函数2:保存最优模型
checkpoint = ModelCheckpoint(
                                filepath='./save_weights/myDenseNet121.h5', #保存模型的路径
                                monitor='val_acc', #需要监视的值
                                save_weights_only=False, #若设置为True,则只保存模型权重,否则将保存整个模型(包括模型结构,配置信息等)
                                save_best_only=True, #当设置为True时,监测值有改进时才会保存当前的模型
                                mode='auto', #当监测值为val_acc时,模式应为max,当监测值为val_loss时,模式应为min,在auto模式下,评价准则由被监测值的名字自动推断
                                period=1 #CheckPoint之间的间隔的epoch数
                            )

修改如下:

#回调函数2:保存最优模型
checkpoint = ModelCheckpoint(
                                filepath='./save_weights/myDenseNet121.h5', #保存模型的路径
             修改的地方:        monitor='val_accuracy', #需要监视的值
                                save_weights_only=False, #若设置为True,则只保存模型权重,否则将保存整个模型(包括模型结构,配置信息等)
                                save_best_only=True, #当设置为True时,监测值有改进时才会保存当前的模型
                                mode='auto', #当监测值为val_acc时,模式应为max,当监测值为val_loss时,模式应为min,在auto模式下,评价准则由被监测值的名字自动推断
                                period=1 #CheckPoint之间的间隔的epoch数
                            )
相关文章
RuntimeError: Given groups=1, weight of size 64 128 1 7, expected input[16,
RuntimeError: Given groups=1, weight of size 64 128 1 7, expected input[16,
2907 0
|
3月前
|
TensorFlow 算法框架/工具 Python
【Tensorflow】Found unexpected keys that do not correspond to any Model output: dict_keys([‘model_outp
文章讨论了在使用Tensorflow 2.3时遇到的错误信息:"Found unexpected keys that do not correspond to any Model output: dict_keys(['model_output']). Expected: ['dense']"。这个问题通常发生在模型的输出层命名与model.fit_generator的生成器函数中返回的值的键不匹配时。
40 1
|
6月前
|
机器学习/深度学习 人工智能
【CatBoost报错解决】CatBoostError: Bad value for num feature[non default doc idx=0,feature idx=19]=
【CatBoost报错解决】CatBoostError: Bad value for num feature[non default doc idx=0,feature idx=19]=
|
TensorFlow 算法框架/工具
解决TypeError: tf__update_state() got an unexpected keyword argument ‘sample_weight‘
解决TypeError: tf__update_state() got an unexpected keyword argument ‘sample_weight‘
273 0
解决TypeError: tf__update_state() got an unexpected keyword argument ‘sample_weight‘
|
JSON 数据格式
ValueError: With n_samples=0, test_size=0.15 and train_size=None, the resulting train set will be em
ValueError: With n_samples=0, test_size=0.15 and train_size=None, the resulting train set will be em
511 0
ValueError: With n_samples=0, test_size=0.15 and train_size=None, the resulting train set will be em
成功解决ValueError: With n_samples=0, test_size=0.3 and train_size=None, the resulting train set will be
成功解决ValueError: With n_samples=0, test_size=0.3 and train_size=None, the resulting train set will be
成功解决ValueError: With n_samples=0, test_size=0.3 and train_size=None, the resulting train set will be
|
JSON 移动开发 算法框架/工具
成功解决raise ValueError(‘No model found in config file.‘) ValueError: No model found in config file.
成功解决raise ValueError(‘No model found in config file.‘) ValueError: No model found in config file.
成功解决_catboost.CatBoostError: Invalid cat_features[4] = 8 value: index must be < 8.
成功解决_catboost.CatBoostError: Invalid cat_features[4] = 8 value: index must be < 8.
torch.distributed.init_process_group(‘gloo’, init_method=‘file://tmp/somefile’, rank=0, world_size=1
torch.distributed.init_process_group(‘gloo’, init_method=‘file://tmp/somefile’, rank=0, world_size=1
602 0
torch.distributed.init_process_group(‘gloo’, init_method=‘file://tmp/somefile’, rank=0, world_size=1
D3 dataset - what is usage of key function in data
Created by Wang, Jerry, last modified on Sep 21, 2015
119 0
D3 dataset - what is usage of key function in data