Non-maximum suppression
Reduce overlapping detector proposals by retaining the most useful scored boxes.
Three boxes cover one object; another box covers a separate object.
The strongest box is considered first. Confidence ordering matters to greedy suppression.
The shaded intersection is large relative to the union. At an IoU threshold of 0.5, this neighbour is suppressed.
Greedy hard NMS keeps the strongest overlapping box and the separate object. Soft-NMS instead adjusts competing scores.
Remove or decay competing scores according to the chosen suppression rule.
Illustrative example. The stages explain the method; they are not a live OpenCV execution.
Try it on an image
Experiment at pixel level
Suppress overlapping candidate boxes. Coordinates use fractions of the input dimensions; each row is [x,y,width,height,score].
The engine loads on your first run. Your images stay in this browser.
Scroll over either image to zoom at the pointer. Use the scrollbars to pan both views over the same relative area. Zoom is relative to the input; pixel coordinates belong to each image. Warps can change scene correspondence.
Pixel inspector RGBA · native values · matched scale · 9 × 9 output pixels
Select a pixel
Select a pixel
When to use it
Turn dense object-detector output into a smaller set of final detections.
How it works
- 01Sort or select candidate boxes by confidence.
- 02Keep a strong box and compare overlaps with remaining candidates.
- 03Remove or decay competing scores according to the chosen suppression rule.
IoU = intersection area / union area
What to tune
score_threshold removes weak proposals; nms_threshold controls overlap tolerance; batched NMS separates classes.
Where it breaks down
Nearby objects can suppress each other. Class handling and box coordinate conventions must match the model output.
TypeScript API
Open an entry for its exact overloads, parameter descriptions, result ownership and pinned upstream source.
All of these calls execute on the CPU. Native objects need explicit disposal. See matrices and ownership and build compatibility.