KeyError:"val_acc"报错原因分析

KeyError:
原因分析:问题出现主要是版本问题,最新的版本
callback = [
ModelCheckpoint(
# ‘./ckpt/fine_tuning/weights.{epoch:02d}-{val_acc:.2f}.hdf5’, 这里的val_acc:参数错误需要更改为新的参数或者去掉
‘./ckpt/fine_tuning/weights.{epoch:02d}.hdf5’,
monitor=‘val_acc’,
save_best_only=True,
save_weights_only=True,
mode=‘auto’,
period=1),
TensorBoard(log_dir="./graph")

解决办法:修改参数为

 check = keras.callbacks.ModelCheckpoint(
        filepath=r"D:\07tensorflow113\01_tensorflow\01_temp\05_singlennckpt\SingleNN_epoch{epoch:02d}-accuracy{accuracy:.2f}.h5",
        monitor='accuracy',
        save_best_only=True,
        save_weights_only=True,
        mode='auto',
        period=1
    )
check = keras.callbacks.ModelCheckpoint(
            filepath=r"D:\07tensorflow113\01_tensorflow\01_temp\05_singlennckpt\SingleNN_epoch{epoch:02d}-accuracy{loss:.2f}.h5",
            monitor='loss',
            save_best_only=True,
            save_weights_only=True,
            mode='auto',
            period=1
        )

你可能感兴趣的:(python,人工智能物体检测)