Object Detection Metrics: Precision, Recall and mAP Explained

An object detector outputs boxes, classes and confidence scores, and judging it means deciding which boxes count as correct. Precision, recall and mean average precision are the standard measures, and each answers a different question. Understanding how they are calculated makes it possible to compare models fairly and to choose a confidence threshold that suits the product rather than the leaderboard.

At a glance

TP/(TP+FP)
Precision: the share of detections that are correct.
TP/(TP+FN)
Recall: the share of real objects that were found.
IoU 0.5
A common overlap threshold for counting a predicted box as a match.
0.5:0.95
The COCO convention, averaging over IoU thresholds from 0.5 to 0.95.

The problem

A single mAP figure hides the trade-off the product actually faces. A detector can score well overall while missing a rare but critical class, or while producing more false alarms than an operator will tolerate.

Figures are also computed differently. The PASCAL VOC convention uses one IoU threshold of 0.5, while COCO averages over ten thresholds, so mAP values calculated under different protocols cannot be compared. Results on a public benchmark also say little about performance on your own images.

Report precision and recall at the threshold you will ship, per class. mAP alone does not tell you that.

From boxes to mAP

Intersection over union is the overlap area of a predicted and a true box divided by the area of their union. Detections are sorted by confidence and matched to unmatched true boxes above the IoU threshold; duplicates and unmatched detections are false positives, and unfound objects are false negatives.

Sweeping the confidence threshold traces a precision-recall curve. Average precision is the area under that curve for one class, and mAP is the mean across classes, and in COCO also across IoU thresholds.

What good looks like

Agree the evaluation protocol, IoU threshold and test set before comparing any models.

Decide which error costs more in the product, a missed object or a false alarm, and per class if needed.

Choose the operating confidence threshold from the precision-recall curve and report both values at that point.

Detection metric vocabulary
TermMeaning
True positive (TP)A detection matched to a real object above the IoU threshold
False positive (FP)A detection with no matching object, or a duplicate
False negative (FN)A real object with no matching detection
IoUOverlap area divided by union area of two boxes
PrecisionTP divided by all detections
RecallTP divided by all real objects
APArea under the precision-recall curve for one class
mAPAP averaged over classes, and in COCO over IoU thresholds
Standard definitions used by the common benchmarks.
IoU of two equal boxes offset sideways
IoU
No offset1
10% offset0.82
20% offset0.67
33% offset0.5
50% offset0.33
One box shifted by a fraction d of its width gives IoU = (1 - d) / (1 + d). A shift of one third already reaches the common 0.5 threshold.

What it changes

Fair Comparisons

Models are scored under the same protocol on the same data.

Product Fit

The threshold reflects the real cost of each error type.

Visible Weaknesses

Per-class results expose classes the average conceals.

Clear Acceptance

Pass criteria are numbers everyone understands.

Where to go next

For counting or tracking applications, add task-level checks such as count error per image, since a good mAP does not guarantee correct counts.

Inspect false positives and false negatives by eye. Patterns in the errors, such as small, distant or partly hidden objects, usually point to missing training data.

Problems this prevents

  • mAP values from different protocols compared
  • A rare class hidden by the average
  • A threshold chosen without considering cost
  • Recall reported without precision

Discuss your project

Email support@aavico.com or use Get in Touch when the website finishes loading.