Non-Maximum Suppression: One Box Per Object

Non-Maximum Suppression (NMS) ensures each detected object gets just one bounding box. It sorts all proposed boxes by confidence, keeps the best one, and discards others that overlap it too much.
Why it exists
Object detection models are designed to be sensitive and often propose multiple bounding boxes for the same object, with slightly different positions and confidence scores. Without a cleanup step, you would get a messy, redundant output where a single car might be identified by five overlapping boxes. NMS solves this by reducing redundancy and selecting the single best box per object.
The mental model
Think of NMS as a competition where bounding boxes for the same object vie for the top spot. The box with the highest confidence score wins. All other boxes that are "too similar"—meaning they overlap the winner significantly—are eliminated. This process repeats until every box has either won its local competition or been eliminated.
How it works
The standard algorithm, called Greedy NMS, follows a simple procedure. First, it takes all proposed bounding boxes and sorts them from highest to lowest confidence score. Second, it selects the box with the highest score and adds it to the final list of detections. Third, it calculates the Intersection over Union (IoU)—a measure of overlap—between this winning box and all other remaining boxes. Any box with an IoU above a predefined threshold (e.g., 0.5) is suppressed. This process is repeated with the next-highest-scoring box that hasn't been suppressed, until no boxes are left. A variant called Soft NMS doesn't discard overlapping boxes but instead reduces their confidence scores, offering a more gradual suppression.
When to use it
NMS is a fundamental step in almost all modern object detection pipelines, such as YOLO, SSD, and Faster R-CNN. It is applied after the model has generated its initial set of raw predictions and before the final results are displayed or used. It is crucial for improving precision and reducing false positives.
When not to use it
The main weakness of Greedy NMS is when multiple distinct objects are very close together. If the bounding box for one object has a high confidence score, it might suppress the legitimate (but lower-confidence) box for a nearby object if their overlap exceeds the threshold. In these cases, variants like Soft NMS might be more appropriate as they penalize rather than eliminate overlapping boxes.
One canonical example
An object detector analyzing a photo of a crowded street might generate ten overlapping boxes for a single pedestrian. NMS takes these ten boxes, sorts them by confidence, and selects the one with the highest score (say, 98%). It then checks the other nine boxes. If any of them have an IoU greater than 0.5 with the 98% box, they are discarded. This leaves a single, clean detection for that pedestrian.
Interview question
What is a primary drawback of the standard Greedy Non-Maximum Suppression (NMS) algorithm?
- a.It fails to effectively remove redundant boxes for a single detected object.
- b.It can mistakenly suppress legitimate detections for distinct, closely-located objects.Correct
- c.It is too computationally intensive for most real-time object detection pipelines.
- d.It prioritizes the highest confidence score even if that box is poorly localized.
Why? this is the answer
The card states that Greedy NMS's main weakness is when multiple distinct objects are very close, as it might suppress a legitimate box for a nearby object. Option D is tempting because confidence is central to NMS, but the core issue described is the suppression of *other valid* boxes, not necessarily the poor localization of the chosen box itself.
Just read this? Test yourself on what you have been reading.
Read the original → geeksforgeeks.org
- #computer vision
- #object detection
- #machine learning
- #nms
You just looked this up. Could you explain it out loud?
That is the part interviews actually test. Tezvyn takes questions like this one and gives you what the interviewer is really checking, the answer that lands, and the mistake that ends the conversation, in the four minutes before your next meeting.
The iPhone app is on the way
We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.
Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.
We are hiring for this. Open roles that interview on computer vision — each one lists the topics its interview covers.
See open roles