Articles
Object Detection Interview Questions: IoU, NMS, mAP, and Error Analysis
Solve object detection interview questions with IoU calculations, NMS traces, precision-recall matching, mAP interpretation, and practical error analysis.
Object detection interview questions combine geometry, ranking, and evaluation. You need to calculate how well two boxes overlap, explain why duplicate predictions are removed, and show how predicted boxes become true positives or false positives under a specific evaluator.
IoU measures overlap. NMS suppresses selected overlapping predictions. Average precision summarizes a precision-recall relationship under defined matching rules. These tools solve different problems, so changing one threshold can affect the pipeline in a different way from changing another.
This guide works through small numerical examples before moving to error analysis. The scenarios are original practice examples, and metric definitions should always be matched to the benchmark being discussed.
How do you calculate intersection over union?
For two boxes, intersection over union is the area they share divided by the area covered by either box. The union is the sum of their areas minus the overlap, because adding both areas counts the overlap twice.
Suppose each box has area 100 and their intersection has area 60:
union = 100 + 100 - 60 = 140
IoU = 60 / 140 = 0.4286, approximately
For axis-aligned boxes in (x1, y1, x2, y2) form, compute the intersection width from the smaller right edge minus the larger left edge, clipped at zero. Do the same for height. Multiply them, then divide by the union under the evaluator's valid-box conventions.
Coordinate conventions matter. Continuous coordinates and some older inclusive-pixel conventions use different area arithmetic. State the convention instead of adding one to widths and heights by habit. Also clarify how invalid or zero-area boxes are handled by the actual API.
Why is IoU harder for small objects?
A fixed coordinate error can occupy a large fraction of a small object's dimensions. Shifting a small box by a few pixels can reduce overlap much more than the same shift on a large box. This is one reason to inspect detection quality by object size.
Consider two square objects, one ten pixels wide and one one hundred pixels wide. A two-pixel horizontal shift is a fifth of the smaller width but only a fiftieth of the larger width. The geometric penalty is different even before you consider image resolution or annotation uncertainty.
Do not conclude that all small-object errors are localization errors. The model may fail to detect the object at all, confuse its class, or lose it during resizing. Separate those cases by inspecting predictions and annotations.
In an interview, connect the geometry to a concrete next step: examine small-object slices, preprocessing resolution, and the type of error before proposing a larger model.
What does non-maximum suppression do?
In a common greedy NMS procedure, predictions are considered by descending score. Keep a high-scoring box and suppress lower-scoring boxes whose overlap with it exceeds the selected threshold, according to the implementation's comparison rule. Continue with the remaining candidates.
Take three same-class predictions: A scores 0.95, B scores 0.85, and C scores 0.70. Suppose IoU(A,B) is 0.70 and IoU(A,C) is 0.10. With a threshold of 0.50, A is retained, B is suppressed, and C remains for consideration.
NMS is a postprocessing decision about redundant predictions. It does not calculate average precision or decide whether a kept box matches ground truth. A high-scoring wrong box can suppress a better-localized lower-scoring box, which is one reason postprocessing can affect recall.
Should NMS be class-aware?
That depends on the model and task. Class-aware processing usually suppresses duplicates within a class, while class-agnostic processing can suppress boxes across classes. The choice can matter when different objects overlap or when one object receives several competing labels.
For example, an overlapping person and bicycle should not necessarily compete as duplicate instances of the same class. On the other hand, a task with mutually exclusive labels for one physical object may need a deliberate policy for conflicting class predictions.
State the desired output contract before choosing the variant. Also inspect maximum-detection limits and pre-NMS score filtering. A true object can disappear before NMS if the score threshold is too high, and it can disappear afterward if output limits are too restrictive.
Equal scores can produce tie behavior that depends on implementation and device. Do not make a correctness test depend on one arbitrary tie ordering unless the API promises it.
How does a prediction become a true positive?
Under a simplified single-class evaluation at one IoU threshold, predictions are sorted by confidence and matched to eligible ground-truth objects according to the evaluator's rules. A prediction that matches an available ground truth sufficiently can count as a true positive. A duplicate prediction for an already claimed object can count as a false positive.
Suppose an image contains two objects. The top prediction correctly matches object one. The second prediction is another box for object one. The third correctly matches object two. In this simplified setting, the sequence is TP, FP, TP.
After the first prediction, precision is 1/1 and recall is 1/2. After the duplicate, precision is 1/2 while recall stays 1/2. After the third, precision is 2/3 and recall is 2/2. This shows why several boxes around one object do not earn repeated credit.
Real evaluators add rules for classes, ignored or crowd annotations, area ranges, and maximum detections. Use the exact benchmark implementation when computing reported metrics.
What is average precision, and what does mAP mean?
Average precision summarizes detection precision across recall levels under a defined procedure. Mean average precision averages AP across specified categories or settings. The exact interpolation, recall sampling, IoU thresholds, and aggregation rules depend on the benchmark.
COCO-style reporting commonly includes AP averaged across multiple IoU thresholds from 0.50 through 0.95, along with additional size and recall summaries. AP at IoU 0.50 is a different metric from that multi-threshold average, even when both are casually called mAP.
| Reported value | What must be stated |
|---|---|
| AP50 | Matching threshold and evaluator definition |
| AP75 | Stricter overlap threshold under the evaluator |
| COCO-style AP | IoU range, class averaging, and standard evaluation settings |
| Small-object AP | Benchmark's object-size definition and subset |
| Recall | Score, matching, and maximum-detection settings |
Never compare two model scores until you know they use the same dataset split and metric definition. A larger number can result from an easier IoU threshold rather than a better detector.
How do score and IoU thresholds affect results?
A confidence threshold decides which predictions are eligible for the application's output. Raising it generally removes more low-scoring candidates, which can reduce false positives but also miss true objects. The exact effect depends on the score distribution.
The NMS IoU threshold controls how aggressively overlapping predictions suppress one another. A low threshold may remove nearby true objects in crowded scenes. A high threshold may leave more duplicates. The evaluation IoU threshold is a third concept: it determines how closely a prediction must match ground truth for metric credit.
Keep all three names distinct when explaining a failure. “The threshold is too high” is ambiguous. State whether you mean score filtering, NMS overlap, or evaluation matching.
Choose application thresholds on an appropriate validation set and evaluate the consequences at the deployment operating point. Optimizing a single benchmark number does not automatically meet a product's false-alert or missed-object requirements.
How do you distinguish classification and localization errors?
Inspect whether a prediction overlaps a real object, whether its class is correct, and whether another prediction already matched that object. A wrong class on a well-localized box suggests a different issue from a correct class with poor coordinates.
Create a small error taxonomy: missed objects, background false positives, class confusion, localization failures, and duplicates. Count and visualize representative examples rather than relying only on the overall metric.
For example, if vehicles at night are mostly missed, changing NMS may not address the main problem. If many predictions correctly identify cars but produce two boxes per car, duplicate handling is a more plausible place to inspect. If coordinates are consistently shifted, preprocessing and coordinate conversion deserve attention before retraining.
The goal is to choose an intervention that corresponds to observed errors. A taxonomy is useful only if it changes what you investigate next.
Why can a detector score well overall but fail users?
Aggregate metrics can hide important slices. Object size, lighting, camera angle, occlusion, motion blur, scene density, and source domain can all change performance. A frequent easy category can conceal failure on a less common but important one.
Build slices that correspond to real usage and available data, then report sample size and uncertainty where appropriate. A slice containing only a handful of objects cannot support the same confidence as a large, representative evaluation.
Annotation quality also matters. Missing ground-truth boxes can make correct predictions appear false, and inconsistent class definitions can make both training and evaluation misleading. Review a sample of apparent errors with the annotation policy in hand.
Do not repeatedly tune on the final test set. Use validation data to select thresholds and changes, then preserve an untouched evaluation for the final claim. Dataset leakage can make an impressive detection score uninformative about deployment.
How do you test box-processing code?
Use simple cases with hand-computable geometry: identical boxes, disjoint boxes, one box inside another, edge-touching boxes, and the partial-overlap example above. Verify coordinate ordering and units at every conversion boundary.
For NMS, test separated objects, duplicate boxes, equal scores, multiple classes, and a crowded scene. Check the retained indices and the intended class policy. For evaluation, use a tiny dataset where you can trace TP, FP, and unmatched ground truth manually.
Geometry test: identical boxes -> IoU 1
Geometry test: disjoint positive-area boxes -> IoU 0
Matching test: two predictions for one object -> at most one match
Pipeline test: resize then map boxes back -> original coordinates recover
Coordinate round trips are especially valuable. A correct detector can look inaccurate when deployment rescales boxes using the wrong padding or aspect-ratio rule.
What is a strong object-detection interview answer?
Start with a small example and name the evaluator. Calculate IoU, trace NMS, then show how retained predictions are matched to ground truth and accumulated into precision and recall. Explain which threshold belongs to which stage.
For a debugging question, ask for representative failed examples and slice the error before proposing a model change. Mention annotation and preprocessing checks when they fit the evidence. This shows that you can evaluate a detection system rather than only define its acronyms.
How do you choose the next experiment after reviewing errors?
Start with a specific failure group, such as small pedestrians at dusk, rather than changing the entire training recipe. Count examples in that group and inspect whether the annotations are complete. Then choose one intervention: more representative labeled data, a suitable input resolution, or a targeted augmentation policy. Keep the evaluation slice fixed so the comparison means something.
Report both the targeted result and overall performance. Improving one slice can increase latency or hurt another class. Inspect a few successful and failed detections after the change; a metric alone can hide a new failure pattern. The goal is a better application outcome, not simply a higher headline mAP.
Sources and Further Reading
Research checked September 24, 2026. Worked counts use simplified single-class matching; benchmark reports must use their full official evaluator and settings.