0
0
Computer Visionml~8 mins

Random erasing in Computer Vision - Model Metrics & Evaluation

Choose your learning style9 modes available
Metrics & Evaluation - Random erasing
Which metric matters for Random Erasing and WHY

Random erasing is a data augmentation method used in computer vision to improve model robustness. The key metrics to watch are validation accuracy and generalization performance. This means how well the model predicts on new, unseen images. Random erasing helps the model not rely on specific parts of an image, so accuracy on test data usually improves.

Also, watch training loss to ensure the model is learning well despite the added noise. If training loss stays reasonable and validation accuracy improves, random erasing is helping.

Confusion Matrix Example

Imagine a model classifying images into cats and dogs. After training with random erasing, the confusion matrix might look like this:

      | Predicted Cat | Predicted Dog |
      |---------------|---------------|
      | True Cat: 45  | 5             |
      | True Dog: 7   | 43            |
    

Here, TP (True Positives) for cats = 45, FP (False Positives) for cats = 5, FN (False Negatives) for cats = 7, and TN (True Negatives) for cats = 43.

Precision for cats = 45 / (45 + 5) = 0.9, Recall for cats = 45 / (45 + 7) = 0.865.

Precision vs Recall Tradeoff with Random Erasing

Random erasing can help improve recall by forcing the model to recognize objects even if parts are missing or occluded. This means the model misses fewer true objects.

However, if random erasing is too strong, it might confuse the model and lower precision, causing more false alarms.

For example, in a face recognition system, high recall means fewer missed faces (good for security). But too many false alarms (low precision) can annoy users. Random erasing helps balance this by making the model robust but not careless.

Good vs Bad Metric Values for Random Erasing

Good: Validation accuracy improves or stays stable compared to no augmentation. Precision and recall both increase or remain balanced. Training loss decreases steadily.

Bad: Validation accuracy drops significantly, or recall improves but precision drops too much. Training loss stays high or fluctuates wildly, showing the model struggles to learn.

Common Pitfalls with Metrics and Random Erasing
  • Accuracy paradox: Accuracy might look good if the dataset is unbalanced, hiding poor recall on rare classes.
  • Data leakage: If random erasing is applied incorrectly (e.g., on test data), metrics become unreliable.
  • Overfitting indicators: If training accuracy is very high but validation accuracy is low, random erasing might not be helping or is too weak.
  • Too aggressive erasing: Can harm learning and reduce all metrics.
Self Check

Your model trained with random erasing has 98% accuracy but only 12% recall on the rare class. Is it good for production?

Answer: No. The low recall means the model misses most examples of the rare class. Even with high accuracy, it fails at detecting important cases. Random erasing should help improve recall by making the model robust to missing parts, so you need to adjust augmentation strength or model design.

Key Result
Random erasing improves model robustness by increasing validation accuracy and recall while maintaining balanced precision.