0
0
Computer Visionml~8 mins

Why CNNs dominate image classification in Computer Vision - Why Metrics Matter

Choose your learning style9 modes available
Metrics & Evaluation - Why CNNs dominate image classification
Which metric matters for this concept and WHY

For image classification using CNNs, accuracy is the most common metric because it shows how many images are correctly labeled out of all images. However, when classes are imbalanced, precision and recall become important to understand if the model is good at finding specific classes without too many mistakes.

Confusion matrix example
      | Predicted Cat | Predicted Dog |
      |--------------|---------------|
      | True Cat: 90 | False Dog: 10 |
      | False Cat: 5 | True Dog: 95  |

      Total samples = 200

      Precision (Cat) = TP / (TP + FP) = 90 / (90 + 5) = 0.947
      Recall (Cat) = TP / (TP + FN) = 90 / (90 + 10) = 0.9
      Accuracy = (TP + TN) / Total = (90 + 95) / 200 = 0.925
    
Precision vs Recall tradeoff with examples

In image classification, sometimes you want high precision to avoid false alarms. For example, if a model detects rare animals, you want to be sure when it says "this is a rare animal" it is correct (high precision).

Other times, you want high recall to catch all instances. For example, in medical image classification, you want to find all tumors even if some false alarms happen (high recall).

CNNs help balance this tradeoff by learning detailed features that improve both precision and recall compared to older methods.

What "good" vs "bad" metric values look like for this use case

Good: Accuracy above 90%, precision and recall both above 85% means the CNN is correctly classifying most images and not missing many.

Bad: Accuracy around 50-60% or precision very low (below 50%) means the model guesses poorly or confuses classes a lot.

Common pitfalls in metrics for CNN image classification
  • Accuracy paradox: High accuracy can be misleading if one class dominates the dataset.
  • Data leakage: If test images are too similar to training images, metrics look better than reality.
  • Overfitting: Very high training accuracy but low test accuracy means the CNN memorized training images but can't generalize.
Self-check question

Your CNN model has 98% accuracy but only 12% recall on a rare class like cancer in images. Is it good for production? Why or why not?

Answer: No, it is not good. The model misses 88% of cancer cases (low recall), which is dangerous. High accuracy is misleading because cancer cases are rare. You need to improve recall to catch more cancer cases.

Key Result
Accuracy is key for overall performance, but precision and recall reveal CNN strengths in correctly identifying image classes and handling imbalanced data.