2026.10.06postprocessing

Non-maximum suppression is not an implementation detail

The IoU threshold decides what a crowded scene looks like, and it is rarely tuned.

fig. 5: postprocessing illustration

Benchmarks report accuracy with one suppression threshold, deployments ship with another, and the gap is blamed on the data. In crowded scenes the threshold is doing most of the work.

At 0.45 two people standing shoulder to shoulder are often merged into one detection. At 0.7 the same person is reported twice whenever the model hesitates between a tight and a loose box. Neither is wrong in general; each is wrong for some scene.

Class-agnostic suppression is the other switch. Suppressing across classes removes the bicycle that overlaps its rider. Suppressing per class keeps both but also keeps a 'truck' and a 'bus' on the same vehicle.

keep = torchvision.ops.batched_nms(boxes, scores, class_ids, iou_threshold=0.6)
# class-agnostic variant:
keep = torchvision.ops.nms(boxes, scores, iou_threshold=0.6)

What I do now: pick fifty frames that represent the hard cases, sweep the threshold from 0.3 to 0.8, and look at the pictures side by side. It takes half an hour and replaces a lot of argument.