Mean Average Precision
Detection has no single "accuracy", because a prediction can be right about the class and wrong about the box, by varying amounts. Slide the confidence threshold across a set of detections and watch precision and recall trade against each other the way they did for a plain classifier.
Worth reading first: Bounding Boxes and IoU, Non-Max Suppression
Ask a classifier “is this right?” and the answer is yes or no, one photo, one label. Ask a detector the same question and it does not know what you mean — right about which of its eleven boxes? Right about the class, wrong about the box by how much? Missing two objects entirely? Detection needed a different kind of number, and mAP is what it got.
Why accuracy does not transfer to detection
Accuracy assumes one prediction per example: the model says a label, the label is right or wrong, divide correct by total. A detector breaks that assumption before you can even start counting. One photo might produce zero predictions, three, or eleven, and the number of predictions has no fixed relationship to the number of real objects in the scene.
A prediction can also be right and wrong at the same time: correct class, badly placed box; well-placed box, wrong class; or a box that overlaps two real objects and cannot be cleanly credited to either. “Accuracy” has no sensible definition here, because there is no fixed-size list of comparisons to divide correct by total.
Precision and recall again, now with boxes
The fix is the same two numbers a plain classifier uses, redefined for boxes. Precision asks: of everything the model flagged, how much was real? Recallasks: of everything real, how much did it catch? “Correct” now means the predicted box overlapped a real one enough — the IoU threshold from the earlier chapter — and cleared the model’s confidence threshold too.
Ten fixed detections below are already labelled correct or incorrect against that IoU test, sorted by how confident the model was. Slide the threshold down and more of them get flagged: precision and recall move, and not always in the direction you would guess.
Two real objects in this scene were never detected at all, at any threshold — that is why recall tops out at 75% rather than 100%. Drag the threshold and watch which detections count.
Circles are correct detections, diamonds are false alarms. Dimmed ones sit below the current threshold and are not flagged.
Precision
83%
Recall
63%
Average precision
81%
Averaging across every threshold
Notice precision does not fall smoothly as the threshold drops — it dips whenever a false alarm gets included, then partially recovers when the next correct detection joins. Pick any single threshold to report and you are making an arbitrary call about where on that jagged curve to stand.
Average precision sidesteps the choice: instead of one threshold, take the precision value at every point along the sweep and average them. It is a way of scoring the whole trade-off curve with one number instead of committing to a threshold nobody agreed on in advance. Meanaverage precision then averages that score again, across every object class the detector was tested on — one AP for “pedestrian”, one for “bicycle”, one for “traffic light”, meaned into the single number that gets reported.
What mAP still will not tell you
mAP quietly bakes in a choice it never surfaces: the IoU threshold that defined “correct” in the first place. mAP at IoU 0.5 is a much easier bar to clear than the stricter mAP averaged over IoU 0.5 through 0.95 that benchmarks like COCO now report — the same detector can score respectably on one and mediocrely on the other, and “mAP” alone does not say which was used.
It also treats every miss as equally costly, which is never true in practice. A detector that misses a parked car and one that misses a pedestrian stepping into the road produce the same one-point deduction to AP, and only one of those two failures matters at highway speed. A single mAP number is a fair summary of overall detection quality and a poor guide to which failures you can actually tolerate.
Key takeaways
- Detection has a variable number of predictions per image, some right, some wrong, some missing — plain accuracy has no sensible definition for it.
- Precision and recall return with boxes, where 'correct' means a prediction cleared both an IoU test against ground truth and the confidence threshold.
- Average precision summarises the whole precision/recall sweep into one number rather than committing to an arbitrary threshold; mean average precision averages that again across every class.
- mAP hides which IoU threshold was used to define 'correct' — 0.5 and the stricter 0.5:0.95 average produce very different numbers for the same model.
- mAP treats every missed object as equally costly, when in practice missing a pedestrian and missing a parked car are not remotely the same failure.
Quick check
Answer these to unlock the next chapter — 3 of 4 to pass. You can retake it anytime.
Answer every question to check.
Make a free account to read on
Every chapter is free — an account is how your progress, XP, and streak follow you from your laptop to your phone, and how you show up on the leaderboard. No payment, no trial.