0
0
Computer Visionml~8 mins

Fine-tuning approach in Computer Vision - Model Metrics & Evaluation

Choose your learning style9 modes available
Metrics & Evaluation - Fine-tuning approach
Which metric matters for Fine-tuning approach and WHY

When fine-tuning a computer vision model, the key metrics to watch are accuracy, precision, and recall. Accuracy shows how often the model predicts correctly overall. Precision tells us how many of the positive predictions are actually correct. Recall shows how many of the actual positive cases the model finds.

We focus on these because fine-tuning adjusts a pre-trained model to a new task or dataset. We want to see if the model improves in recognizing the new classes without losing its ability to avoid mistakes. Depending on the task, precision or recall might be more important. For example, in medical image diagnosis, recall is critical to catch all cases.

Confusion matrix example
    | Predicted Positive | Predicted Negative |
    |--------------------|--------------------|
    | True Positive (TP): 80  | False Negative (FN): 20 |
    | False Positive (FP): 10 | True Negative (TN): 90  |

    Total samples = TP + FP + TN + FN = 80 + 10 + 90 + 20 = 200

    Precision = TP / (TP + FP) = 80 / (80 + 10) = 0.89
    Recall = TP / (TP + FN) = 80 / (80 + 20) = 0.80
    Accuracy = (TP + TN) / Total = (80 + 90) / 200 = 0.85
    
Precision vs Recall tradeoff with examples

Fine-tuning can improve either precision or recall, but often improving one lowers the other. For example:

  • High precision, low recall: The model is very sure when it says an object is present, but it misses some objects. Good for tasks where false alarms are costly, like detecting defects in manufacturing.
  • High recall, low precision: The model finds almost all objects but also makes more mistakes. Useful in safety-critical tasks like detecting tumors, where missing any tumor is worse than a false alarm.

Fine-tuning helps balance this tradeoff by adjusting the model to the new data and task.

What "good" vs "bad" metric values look like for Fine-tuning

Good metrics:

  • Accuracy above 85% on the new task dataset
  • Precision and recall both above 80%, showing balanced performance
  • F1 score (harmonic mean of precision and recall) above 0.8

Bad metrics:

  • Accuracy below 70%, indicating poor adaptation
  • Very low recall (e.g., below 50%), meaning many positives missed
  • Very low precision (e.g., below 50%), meaning many false alarms
  • Large gap between precision and recall, showing imbalance
Common pitfalls in Fine-tuning metrics
  • Accuracy paradox: High accuracy can be misleading if the dataset is imbalanced. For example, if 95% of images are negative, a model always predicting negative gets 95% accuracy but is useless.
  • Data leakage: If test images are too similar to training images, metrics look better but the model won't generalize.
  • Overfitting: Fine-tuning too long on a small dataset can cause the model to memorize training images, showing high training accuracy but poor test accuracy.
  • Ignoring class imbalance: Not using metrics like precision, recall, or F1 can hide poor performance on rare classes.
Self-check question

Your fine-tuned model has 98% accuracy but only 12% recall on the positive class (e.g., detecting defects). Is this good for production? Why or why not?

Answer: No, this is not good. The model misses 88% of the positive cases, which is very risky if detecting defects is important. High accuracy is misleading here because the dataset likely has many negatives. You need to improve recall to catch more positives.

Key Result
Fine-tuning success is best judged by balanced precision and recall, not just accuracy.