The accuracy trap
Accuracy collapses two different kinds of mistake into one number. On a balanced problem that is fine. On a skewed one it is actively misleading, because the majority class dominates the score and the model can look excellent while never detecting the thing you built it to detect.
Precision and recall answer different questions
Precision
- Of the items flagged positive, how many really were positive?
- Low precision means false alarms.
- Matters when acting on a false positive is expensive.
Recall
- Of the items that really were positive, how many did the model find?
- Low recall means missed cases.
- Matters when missing a positive is expensive.
Intersection over Union
For a predicted box and a true box, \(\text{IoU} = \frac{\text{area of overlap}}{\text{area of union}}\). The numerator is the region covered by both boxes; the denominator is the region covered by either. A perfect match gives \(1\), boxes that touch but do not overlap give \(0\), and a typical threshold for counting a detection as correct is \(0.5\).
There is no universally best metric. Choose the one whose failure mode matches the cost of being wrong in your application: a screening tool should favor recall, a billing system should favor precision.