NMS<T>

Models & Types · AiDotNet.ComputerVision.Detection.PostProcessing

Implements Non-Maximum Suppression (NMS) algorithms for removing duplicate detections.

For Beginners

When an object detector runs, it often produces multiple overlapping bounding boxes for the same object. NMS removes these duplicates by:

  1. Keeping the detection with highest confidence
  2. Removing other detections that overlap too much with it
  3. Repeating until all duplicates are removed

Constructors

Constructor Summary
NMS() Creates a new NMS instance.

Methods

Method Summary
List<Detection<T>> Apply(List<Detection<T>> detections, double iouThreshold) Performs standard NMS on a list of detections.
List<Detection<T>> ApplyClassAware(List<Detection<T>> detections, double iouThreshold) Performs class-aware NMS (applies NMS separately per class).
List<List<Detection<T>>> ApplyBatched(List<List<Detection<T>>> batchDetections, double iouThreshold, bool classAware) Performs batched NMS for efficient processing of multiple images.
double ComputeCIoU(BoundingBox<T> box1, BoundingBox<T> box2) Computes Complete IoU (CIoU) between two bounding boxes.
double ComputeDIoU(BoundingBox<T> box1, BoundingBox<T> box2) Computes Distance IoU (DIoU) between two bounding boxes.
double ComputeGIoU(BoundingBox<T> box1, BoundingBox<T> box2) Computes Generalized IoU (GIoU) between two bounding boxes.
double ComputeIoU(BoundingBox<T> box1, BoundingBox<T> box2) Computes Intersection over Union (IoU) between two bounding boxes.