Visual AI GUIDE

Non-Maximum Suppression

Non-Maximum Suppression (NMS) is the cleanup step that turns a messy pile of overlapping detection boxes into one tidy box per object.

2 min readLast updated

Overview

Without it, detectors would report the same car five or ten times.

Deep Dive

Object detectors typically predict many candidate boxes around each real object, each with a confidence score. NMS prunes this redundancy. The classic greedy algorithm sorts all boxes by score, keeps the highest-scoring one, then removes any remaining box whose overlap with it (measured by Intersection over Union, IoU) exceeds a threshold such as 0.5. It repeats this on the surviving boxes until none remain. The result is one representative box per object. NMS is simple, fast, and parameter-light, but it has weaknesses: a fixed IoU threshold can wrongly suppress a genuine nearby object in crowded scenes, and it treats overlap as binary. Variants like Soft-NMS decay scores instead of deleting boxes outright to address this.

Technical Insight

The core measure is IoU: the area of the intersection of two boxes divided by the area of their union. Greedy NMS is O(n^2) in the worst case but fast in practice. The IoU threshold trades off precision and recall: a low threshold removes more boxes (risking missed nearby objects), while a high threshold keeps more (risking duplicates). NMS is usually applied per class so boxes of different categories don't suppress each other.

Strategic Impact

Speed and scale

Visual AI can automate inspection, detection, and tagging tasks at scale.

Build choices

Creative teams can prototype concepts faster with fewer manual revisions.

Team and workflow

Operations can use image and video signals that were previously hard to process.

The Future of Non-Maximum Suppression

NMS remains the default post-processor, but the field is moving toward removing it. Soft-NMS, DIoU-NMS, and learned variants improve crowded-scene handling, while end-to-end detectors like DETR use set-based bipartite matching to predict unique boxes directly, eliminating NMS entirely. Expect hand-tuned thresholds to give way to learned or NMS-free designs, especially as transformer detectors mature and real-time systems demand deterministic, branch-free post-processing.

Real-World Implementation

Collapsing dozens of overlapping face boxes into one per face in camera and photo-tagging apps

Producing clean, single bounding boxes per vehicle and pedestrian in autonomous-driving detectors

De-duplicating overlapping text-region boxes in document and license-plate OCR pipelines

Cleaning up redundant object proposals in retail shelf-monitoring and inventory-counting systems

Risks & Guardrails

Image rights and consent can become legal risks if provenance is unclear.

Model performance can vary across lighting, demographics, and environments.

False positives may go unnoticed unless confidence thresholds are monitored.

Implementation Roadmap

1

Define acceptance criteria for precision, recall, and error costs.

2

Test with data that matches real production conditions.

3

Add human review for low-confidence or high-impact predictions.

4

Track model drift and revalidate after camera or dataset changes.

Keep Exploring

Free newsletter

Get the daily AI briefing

Three verified AI stories every weekday morning, written in plain English. Free forever, no ads.

One email each weekday. Unsubscribe in one click. We never sell or share your address.

Test yourself

Take the Non-Maximum Suppression quiz

Instant feedback on every answer, and a shareable certificate with a verifiable ID once you pass a course.

Start quiz

Support free AI education. AI Understanding is a 501(c)(3) nonprofit — no ads, no paywall, ever. Make a donation

Next guide

BYOL and Non-Contrastive Self-Supervision

Frequently asked questions

What is Non-Maximum Suppression?

Non-Maximum Suppression (NMS) is the cleanup step that turns a messy pile of overlapping detection boxes into one tidy box per object. Without it, detectors would report the same car five or ten times.

What is the main purpose of Non-Maximum Suppression in object detection?

NMS eliminates the many overlapping candidate boxes a detector produces, leaving a single representative box per object.

Which metric does standard NMS use to decide whether two boxes overlap too much?

NMS measures overlap with IoU: intersection area divided by union area of the two boxes.

In greedy NMS, which box is selected first in each round?

Greedy NMS sorts boxes by confidence and keeps the highest-scoring one, then suppresses overlapping lower-scoring boxes.

What is a known weakness of greedy NMS in crowded scenes?

Because it deletes any box above the IoU threshold, NMS can wrongly remove a true detection of a different object that happens to overlap.

How does Soft-NMS differ from standard NMS?

Soft-NMS lowers (decays) the confidence of overlapping boxes rather than discarding them, reducing false suppression in crowded scenes.