Modules/Computer Vision/ NMS Lab

IoU and Non-Max Suppression

A detector never proposes just one box per object — it proposes dozens. IoU measures how much two boxes overlap; NMS uses that number to collapse the pile back down to one box per object.

NMS Threshold

0.50

boxes A-D are four raw proposals from one detector pass, four confidence scores, two actual objects

Confidence

Proposals

Pairwise IoU

Result

KeptA, D
SuppressedB, C

 

IoU and Non-Max Suppression: A Practical Guide

Turning a pile of overlapping boxes into one box per object.

Quick Context

A detector's region proposal stage doesn't stop at one box per object — it scores hundreds of candidate boxes and keeps every one above a confidence floor, which for a single real object usually means a cluster of overlapping, near-duplicate boxes. Intersection over Union (IoU) is the standard way to measure how much two boxes overlap: the area they share, divided by the total area either one covers. IoU = 1 means identical boxes; IoU = 0 means no overlap at all.

Non-Max Suppression

NMS turns that overlap score into a cleanup rule. Sort every proposal by confidence, descending. Take the top one, keep it, and discard every remaining box whose IoU with it exceeds a threshold — those are treated as duplicate detections of the same object. Move to the next surviving box by confidence and repeat, until nothing is left to process. The threshold is the only knob: too low and boxes on genuinely different but nearby objects get merged into one; too high and duplicate boxes on the same object all survive.

Interactive Exploration Guide

  1. Read the stage at the default threshold. Box A (confidence 0.95) is kept. Box D, a separate object with no real overlap with A, is also kept. Boxes B and C overlap A too heavily and are suppressed as duplicates.
  2. Lower the threshold toward 0.1. Nothing changes here — B and C already fail a much looser bar, so tightening it further has no effect on this particular layout.
  3. Raise the threshold past roughly 0.59. Box B's overlap with A no longer exceeds the (now looser) suppression bar, so B is kept as a second detection of what is really the same object.
  4. Raise it past roughly 0.81. Now C survives too — at this threshold NMS considers all four boxes different enough to keep, even though A, B and C clearly describe one dog.

Key Takeaway

IoU is a pure geometry calculation — it knows nothing about confidence or class. NMS is the policy layer that uses it: keep the most confident box, discard anything that overlaps it past a threshold, repeat. Set the threshold too low and it merges distinct nearby objects into one detection; set it too high and duplicate boxes on the same object all survive. Every object detector that outputs boxes runs some form of this after its raw proposals come out.

Predict, then reveal

About to run: set IoU > to its maximum (0.95). Before it does — what happens to the readout?

Committing to an answer first is the point — the reveal runs the experiment on the visualisation above and reads the real value back, so nothing here is scripted.

Recall check

0 of 3

Say the answer out loud before you reveal it — recalling it is what makes it stick, and rereading it is not.

  1. Without scrolling back — what is the one-line takeaway from this module?

  2. What does this module say about “NMS Threshold”?

  3. What does this module say about “Quick Context”?

Cheat sheet

IoU and Non-Max Suppression

A detector never proposes just one box per object — it proposes dozens. IoU measures how much two boxes overlap; NMS uses that number to collapse the pile back down to one box per object.

COMPUTER VISION · vizlearn.in/computer_vision/iou_and_non_max_suppression.html