For CNNs understanding visual patterns, accuracy is often used to see how well the model recognizes images. But accuracy alone can hide problems. Precision and recall help us know if the model finds the right objects (precision) and finds all objects it should (recall). For example, in object detection, recall is key to not miss objects, while precision avoids false alarms.
Why CNNs understand visual patterns in TensorFlow - Why Metrics Matter
Predicted
Cat Dog
Actual Cat 45 5
Dog 3 47
Total samples = 100
TP (Cat) = 45, FP (Cat) = 3, FN (Cat) = 5, TN (Cat) = 47
Precision (Cat) = 45 / (45 + 3) = 0.94
Recall (Cat) = 45 / (45 + 5) = 0.90
This shows how well the CNN distinguishes cats from dogs.
Imagine a CNN that finds faces in photos. High precision means most faces found are real faces, so few false alarms. High recall means it finds almost every face, even if some are wrong. If you want to tag all faces for a photo album, recall is more important. If you want to unlock your phone only for your face, precision is more important to avoid mistakes.
Good CNN model: accuracy above 90%, precision and recall both above 85%. This means it finds most objects correctly and rarely mistakes others.
Bad CNN model: accuracy around 50-60%, precision or recall below 50%. This means it guesses often or misses many objects.
- Accuracy paradox: High accuracy can happen if data is unbalanced (e.g., mostly one class).
- Data leakage: If test images are too similar to training, metrics look better but model won't generalize.
- Overfitting: Model performs well on training but poorly on new images, metrics differ greatly.
Your CNN model has 98% accuracy but only 12% recall on detecting rare objects. Is it good for production?
Answer: No. The model misses most rare objects (low recall), so it is not reliable despite high accuracy.