I am using a pre trained resnet 50 model for image classification. After running the model for a few epochs here are the results I’ve gotten:
Epoch 8/20 loss: 0.5705 - accuracy: 0.8785 - val_loss: 0.9226 - val_accuracy: 0.8135
Epoch 9/20 loss: 0.5509 - accuracy: 0.8780 - val_loss: 0.9321 - val_accuracy: 0.7979
These results obtained can be improved but let’s just keep these for now.
When I run model.evaluate() I obtain a value I would expect:
# Evaluate the model test_loss, test_acc = model.evaluate(val_data_flow) print("Test accuracy:", test_acc)
Test accuracy: 0.7978515625
When I run Model.predict() the accuracy is abysmal:
precision recall f1-score support
1 0.33 0.38 0.36 330
2 0.00 0.00 0.00 14
3 0.17 0.17 0.17 133
4 0.09 0.11 0.10 102
5 0.00 0.00 0.00 5
6 0.00 0.00 0.00 21
7 0.12 0.12 0.12 133
8 0.18 0.16 0.17 154
9 0.18 0.13 0.15 132
accuracy 0.21 1024
macro avg 0.12 0.12 0.12 1024
weighted avg 0.20 0.21 0.21 1024
What could be causing such issue? Or is It because the functions model.predict and model.evaluate dont work the same way?