1

I am studying for CNN with Google Colab. I tried to print the validation accuracy by training the model. But the problem is that there is only warning sign without 'val_acc'.

Anyone having a woking solution?

This is the code I've used:

from keras.callbacks import ModelCheckpoint, ReduceLROnPlateau
checkp = ModelCheckpoint('./result_model.h5', monitor = 'val_acc', verbose = 1, save_best_only = True)

reduce = ReduceLROnPlateau(monitor = 'val_acc', patience = 20, verbose = 1)



history = model.fit(
    train_dataset,
    validation_data=validation_dataset,
    epochs=100,
    callbacks=[checkp],
)

This is the error:

Epoch 1/100
29/30 [============================>.] - ETA: 0s - loss: 22.8816WARNING:tensorflow:Can save best model only with val_acc available, skipping.
30/30 [==============================] - 9s 121ms/step - loss: 22.8274 - val_loss: 16.4967
Epoch 2/100
29/30 [============================>.] - ETA: 0s - loss: 16.3546WARNING:tensorflow:Can save best model only with val_acc available, skipping.
30/30 [==============================] - 2s 74ms/step - loss: 16.3551 - val_loss: 16.2373
.....
newCoding
  • 11
  • 1
  • What are the losses and and metrics of the model? The model likely doesn't have `acc` metrics – Nuri Taş Oct 10 '22 at 11:25
  • You mean the metrics? I put the code **model.compile(loss = categorical_crossentropy', metrics=['accuracy'],optimizer = 'adam', )** in the model, but it doesn't work – newCoding Oct 10 '22 at 17:42
  • Hi @newCoding, try explicitly writing the name of the metric you are wanting to calculate as mentioned [here](https://stackoverflow.com/a/61510447/14290697) and let us know if the issue still persists. Thank you! –  Oct 12 '22 at 06:30

0 Answers0