Evaluation Metrics for Computer Vision
Classification Metrics
Top-1 Accuracy — Fraction where the highest-probability prediction is correct. Top-5 Accuracy — Fraction where the correct class is in the top 5 predictions. Standard on ImageNet. Confusion Matrix — N×N matrix showing class-by-class predictions. Reveals systematic confusion between similar classes.
Detection Metrics — mAP
IoU (Intersection over Union) — measures overlap between predicted and ground truth box: IoU = Area(pred ∩ gt) / Area(pred ∪ gt) A prediction is a True Positive if IoU ≥ threshold (usually 0.5). AP (Average Precision) — area under the Precision-Recall curve for one class. mAP — mean AP across all classes. Standard: mAP@0.5 and mAP@0.5:0.95 (COCO).
Segmentation Metrics
Pixel Accuracy — fraction of correctly classified pixels. Misleading with class imbalance. mIoU (mean Intersection over Union) — standard metric. Compute IoU per class, average across classes: IoU_class = TP / (TP + FP + FN) mIoU = mean(IoU_class for all classes) Dice Score — 2·TP / (2·TP + FP + FN). Equivalent to F1. Preferred in medical imaging.
Computing CV Metrics
mAP for detection with torchmetrics, mIoU and Dice score for segmentation.
Never report only pixel accuracy for segmentation — a model predicting all background on a mostly-background dataset gets 95%+ accuracy without detecting anything.
Finished reading? Mark it complete to earn your XP.