我正在尝试获得验证准确性并选择保存具有最佳准确性的模型。但是在第一个时期之后,它显示检查点错误。
filepath="tumor_detection-{epoch:02d}-{val_acc:.2f}.hdf5"
# save the model with the best validation (development) accuracy till now
checkpoint = ModelCheckpoint(filepath, monitor='val_acc', verbose=1, save_best_only=True, mode='max')
%%time
model.fit(xtrain,ytrain,batch_size=32,epochs=30,validation_data=(xval,yval),callbacks=[checkpoint])```
It is then showing an error as follows:
Epoch 1/30
51/51 [==============================] - ETA: 0s - loss: 0.4651 - accuracy: 0.7725
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/callbacks.py in _get_file_path(self, epoch, logs)
1243 # placeholders can cause formatting to fail.
-> 1244 return self.filepath.format(epoch=epoch + 1, **logs)
1245 except KeyError as e:
KeyError: 'val_acc'
During handling …Run Code Online (Sandbox Code Playgroud)