Skip to content

Non-maximum suppression

Reduce overlapping detector proposals by retaining the most useful scored boxes.

Try it on your image ↓

VISUAL WALKTHROUGHDetection
REFERENCE INPUTOverlapping detections

Three boxes cover one object; another box covers a separate object.

RESULTTwo detections remain

Greedy hard NMS keeps the strongest overlapping box and the separate object. Soft-NMS instead adjusts competing scores.

STEP 03 / 03

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

YOUR IMAGE · REAL OPENCV

Experiment at pixel level

Open full lab ↗

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.

Input448 × 320
OutputWaiting for a result

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
Hover to inspect. Click to pin a pixel.
Input
Select a pixel

Output
Select a pixel

Sample models and licenses

When to use it

Turn dense object-detector output into a smaller set of final detections.

How it works

  1. 01Sort or select candidate boxes by confidence.
  2. 02Keep a strong box and compare overlaps with remaining candidates.
  3. 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.