Mean Average Precision (mAP) Calculator
Paste a ranked list of TP/FP detections and a ground-truth count to get Average Precision and mean Average Precision, the full precision–recall table, and both 11-point and all-point interpolation. Matches PASCAL VOC and the COCO area method, and shows the scikit-learn step sum alongside. No signup, nothing uploaded.
How it works
Average Precision (AP)summarises a detector's precision–recall curve for one class as a single number; mean Average Precision (mAP) averages AP over all classes. This tool takes detections you have already matched to ground truth as true positives (TP) or false positives (FP) — for example at IoU ≥ 0.5 — in confidence-descending order, and follows the definitions in the PASCAL VOC challenge (Everingham et al., 2010) and COCO evaluation.
Let G be the ground-truth positive count for the class. Walking the ranked list from the top, the tool accumulates true and false positives and, at each rank i, records:
- Precision.
Pᵢ = cumTPᵢ / (cumTPᵢ + cumFPᵢ)— the share of detections so far that are correct. - Recall.
Rᵢ = cumTPᵢ / G— the share of all real objects found so far. - Interpolated precision. Make precision monotonically non-increasing from the right:
p_interp(r) = max{ Pⱼ : Rⱼ ≥ r }. This removes the zig-zag so a later, higher precision lifts earlier points. - Average Precision. The all-point AP (PASCAL VOC 2010+, the COCO area method) is the area under that interpolated curve:
AP = Σₙ (Rₙ − Rₙ₋₁)·p_interp(Rₙ), summed where recall increases with R₀ = 0. The 11-point AP (PASCAL VOC 2007) instead averages p_interp at recall 0, 0.1, … 1.0:AP = (1/11)·Σ p_interp(r). - mAP. Repeat per class and take the unweighted mean:
mAP = (1/C)·Σ_c AP_c.
Where the TP and FP labels come from
The calculator starts one step after matching. In VOC and COCO a detection is a true positive when its box overlaps a ground-truth box of the same class with Intersection over Union at or above the threshold — 0.5 for VOC and [email protected], a sweep of 0.50 to 0.95 for the COCO headline number. Each ground-truth object may be matched at most once: if two boxes land on the same object, the higher-confidence one is the TP and the second is a false positive, however good its overlap. Objects the detector never finds are false negatives and never appear in the list at all; they only enter the maths through G. If you need to compute the overlaps themselves first, the IoU calculator takes two box coordinates and returns the ratio; the confusion matrix calculator is the right tool once you want per-class TP, FP and FN counts rather than a ranked curve.
Three conventions, three slightly different numbers
scikit-learn's average_precision_score uses the non-interpolated step sum Σ (Rₙ − Rₙ₋₁)·Pₙ (precision at each threshold, no envelope), which can differ slightly from the VOC interpolated area — 0.8056 against 0.8333 on the default example. The calculator shows that value separately so numbers reconcile with whichever library you compare against. COCO uses the same VOC2010 envelope but samples it at 101 recall points; the area version here is the continuous limit of that, and on small lists the two agree to three decimals. As a credibility check, the all-point AP is computed twice — once by summing recall-jump rectangles and once by the canonical VOC array method — and the page confirms the two agree to floating-point precision. This version computes AP at a single operating point; the full COCO [email protected]:0.95 sweep across IoU thresholds needs per-box IoU inputs, which is a different workflow from a pasted label list.
What counts as a good mAP?
There is no universal pass mark, because AP depends on how hard the dataset is. On COCO, a strong general-purpose detector in 2026 reaches roughly 0.55 to 0.65 [email protected]:0.95 and 0.70 to 0.80 [email protected]; on PASCAL VOC the same architectures clear 0.85 [email protected]. A narrow custom dataset — the single-class or few-class detectors that final-year projects at Sri Lankan universities typically build for paddy disease, vehicle plates or tea-leaf grading — often scores 0.85 to 0.95 [email protected] with a few hundred labelled images, simply because the classes are visually distinct and the backgrounds repeat. The bands the tool shows (Excellent ≥ 0.90, Strong ≥ 0.75, Moderate ≥ 0.50, Weak below) are a reading aid, not a standard: compare against a baseline trained on the same split, and report the IoU threshold every time you quote the number.
Edge cases the calculator handles
- Recall that never reaches 1. If the list contains fewer true positives than
G, the curve stops early and the missing area counts as zero. Both conventions penalise this, but by different amounts — see the third worked example. - Duplicate detections. A second box on an already-matched object is an FP, so a detector that fires twice on every object loses precision at every rank even though it missed nothing. The fourth worked example shows the cost.
- All false positives. Precision is 0 at every rank and recall never rises, so AP is exactly 0 under every convention.
- A perfect list. TP at every rank with cumulative TP equal to
Ggives precision 1 everywhere and recall exactly 1, so AP is exactly 1. - Invalid input. An empty list, an unrecognised token, more than 500 detections, a non-integer
G, or aGsmaller than the TP count (which would push recall above 1) each produce a named error instead of a wrong number.
Worked examples
mAP versus the other ranking metrics
mAP is one member of a family of rank-aware metrics, and picking the wrong one is a common review comment on Sri Lankan final-year and MSc project reports. If you are evaluating a search engine, recommender or retrieval-augmented generation pipeline rather than a detector, the same “TP at rank i” idea applies but the conventions differ. The precision and recall at k calculator cuts the list at a fixed depth instead of integrating over every recall level, which is what a product team usually wants for a “top 10 results” page. The mean reciprocal rank calculator scores only the position of the first relevant hit, so it suits question answering where one right answer is enough. The NDCG calculator handles graded relevance (highly relevant, partly relevant, irrelevant) where mAP only knows relevant and not.
For a classifier with no ranking at all, AP still exists — it is the area under the precision–recall curve as you sweep the decision threshold — but most people want the simpler threshold-fixed F1 score or the ROC-AUC. A rule of thumb: ROC-AUC when the classes are balanced, AP or precision–recall AUC when the positives are rare, and mAP whenever there is more than one class to average over. Whichever you choose, state the IoU threshold, the split, and the interpolation convention in the report — the same detections can legitimately score 0.8333, 0.8409 or 0.8056 depending on that last choice, and a reviewer who cannot reproduce your number will assume the worst.
Frequently asked questions
Sources & references
- PASCAL VOC Challenge (Everingham et al., 2010) — the AP definition, VOC2007 11-point and VOC2010+ all-point interpolation
- COCO detection evaluation — AP over IoU 0.50:0.05:0.95, [email protected], and mAP as the mean of per-class AP
- scikit-learn — average_precision_score: the non-interpolated step-sum AP shown alongside the VOC area
The formulas on this page were last cross-checked against these sources on 2026-09-08. AP and mAP are stable mathematical definitions, so this tool needs no rate or schedule updates — only the worked examples are periodically re-reconciled against the PASCAL VOC dev-kit.
Related tools
Comments & feedback
Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.
Found a bug, edge case, or want to suggest an improvement?
Email me at [email protected] — most fixes ship within 24 hours.