Home โ€บ IoU, NMS & Object Detection Metrics Simulator

IoU, NMS & Object Detection Metrics Simulator

Interactively calculate Intersection over Union (IoU), GIoU, DIoU, and simulate Non-Maximum Suppression (NMS) with customizable confidence and IoU thresholds.

๐Ÿ“– Understanding IoU (Intersection over Union) & Non-Maximum Suppression (NMS)

Object detection models such as YOLO, Faster R-CNN, SSD, and DETR rely on two foundational geometric algorithms: Intersection over Union (IoU) to measure how closely a predicted bounding box overlaps a ground-truth annotation, and Non-Maximum Suppression (NMS) to filter out redundant overlapping predictions around the same object. The DevPanda Detection Metrics tool provides an interactive canvas where you can drag bounding boxes, inspect exact overlap geometry, and simulate NMS step-by-step.

๐Ÿš€ How to Use This Tool

  1. In the IoU Calculator tab, drag the Ground Truth and Prediction bounding boxes on the interactive canvas or enter exact [x, y, width, height] coordinates.
  2. Observe the live intersection area, union area, and resulting IoU score alongside qualitative match quality indicators.
  3. Switch to the NMS Simulator tab to test how multiple candidate boxes with different confidence scores are filtered.
  4. Adjust the Confidence Threshold and IoU Suppression Threshold sliders to see which bounding boxes survive NMS and which are suppressed.

๐Ÿ“ Mathematical Mechanics of IoU and Greedy NMS

  • Intersection over Union (Jaccard Index): IoU(A, B) = Area(A โˆฉ B) / Area(A โˆช B) = Area(A โˆฉ B) / (Area(A) + Area(B) - Area(A โˆฉ B)). An IoU of 1.0 indicates identical boxes, 0.0 indicates zero overlap, and โ‰ฅ 0.50 or โ‰ฅ 0.75 is commonly used to classify a True Positive.
  • Greedy Non-Maximum Suppression Algorithm: (1) Discard all candidate boxes with confidence score below conf_thresh. (2) Sort remaining boxes by confidence descending. (3) Pick the highest-confidence box M, keep it, and remove all other boxes of the same class whose IoU with M exceeds iou_thresh. (4) Repeat until no boxes remain.
  • Beyond Standard IoU (GIoU, DIoU, CIoU): Standard IoU equals 0 whenever two boxes do not overlap, yielding zero gradient for bounding box regression. Generalized IoU (GIoU) and Complete IoU (CIoU) add penalty terms for center distance and aspect ratio so boxes can still optimize toward each other when disjoint.

โ“ Frequently Asked Questions (FAQ)

Q. What happens if the NMS IoU threshold is set too low in crowded scenes?

If two real objects of the same class (e.g., pedestrians in a crowd) stand close together with high overlap, a low NMS IoU threshold (such as 0.3) will mistakenly suppress the lower-confidence pedestrian, reducing Recall. Soft-NMS or higher thresholds (0.5โ€“0.65) help mitigate this.

Q. How do Confidence Threshold and NMS Threshold interact?

Lowering the Confidence Threshold increases Recall (fewer missed objects) but lets through more false positives. NMS only suppresses boxes that overlap a higher-scoring box of the same class; it cannot remove isolated low-confidence false positives.

Q. Why do DETR and YOLOv10 not require NMS at inference?

End-to-end detectors use one-to-one bipartite matching (Hungarian loss) during training, teaching the network to assign exactly one query/anchor per ground-truth object rather than many-to-one positive assignments.