Sobes.tech
Junior — Middle

How does Non-Maximum Suppression (NMS) work and what is it used for?

sobes.tech AI

Answer from AI

Non-Maximum Suppression (NMS) is an algorithm used in object detection tasks to remove redundant overlapping predictions. When a model detects multiple boxes that significantly overlap and refer to the same object, NMS keeps only the one with the highest confidence score, removing the others.

Working principle:

  1. Sort all predicted boxes by decreasing probability.
  2. Select the box with the highest probability and add it to the final set.
  3. Remove from the list all boxes that significantly overlap with the selected one (based on the IoU — Intersection over Union metric — exceeding a specified threshold).
  4. Repeat steps 2-3 until all boxes are processed.

This helps reduce false positives and achieve more accurate detection results.