Class SoftNMS<T>
- Namespace
- AiDotNet.ComputerVision.Detection.PostProcessing
- Assembly
- AiDotNet.dll
Implements Soft-NMS algorithm which reduces confidence of overlapping boxes instead of removing them.
public class SoftNMS<T>
Type Parameters
TThe numeric type used for calculations.
- Inheritance
-
SoftNMS<T>
- Inherited Members
Remarks
For Beginners: Standard NMS completely removes overlapping boxes, which can be problematic when objects are close together or occluded. Soft-NMS instead reduces the confidence score of overlapping boxes, allowing them to potentially survive if their confidence remains above the threshold.
Reference: Bodla et al., "Soft-NMS -- Improving Object Detection With One Line of Code", ICCV 2017
Constructors
SoftNMS()
Creates a new Soft-NMS instance.
public SoftNMS()
Methods
Apply(List<Detection<T>>, double, double, DecayMethod, double)
Applies Soft-NMS with configurable decay method.
public List<Detection<T>> Apply(List<Detection<T>> detections, double iouThreshold, double scoreThreshold, SoftNMS<T>.DecayMethod method, double sigma)
Parameters
detectionsList<Detection<T>>List of detections to filter.
iouThresholddoubleIoU threshold (for linear) or ignored (for Gaussian).
scoreThresholddoubleMinimum score to keep a detection.
methodSoftNMS<T>.DecayMethodDecay method to use.
sigmadoubleSigma parameter for Gaussian decay.
Returns
ApplyClassAware(List<Detection<T>>, double, double, DecayMethod, double)
Applies class-aware Soft-NMS.
public List<Detection<T>> ApplyClassAware(List<Detection<T>> detections, double iouThreshold = 0.5, double scoreThreshold = 0.001, SoftNMS<T>.DecayMethod method = DecayMethod.Gaussian, double sigma = 0.5)
Parameters
detectionsList<Detection<T>>List of detections to filter.
iouThresholddoubleIoU threshold for linear decay.
scoreThresholddoubleMinimum score to keep.
methodSoftNMS<T>.DecayMethodDecay method.
sigmadoubleSigma for Gaussian decay.
Returns
ApplyGaussian(List<Detection<T>>, double, double)
Applies Soft-NMS with Gaussian decay.
public List<Detection<T>> ApplyGaussian(List<Detection<T>> detections, double sigma = 0.5, double scoreThreshold = 0.001)
Parameters
detectionsList<Detection<T>>List of detections to filter.
sigmadoubleGaussian decay parameter (higher = slower decay).
scoreThresholddoubleMinimum score to keep a detection.
Returns
ApplyLinear(List<Detection<T>>, double, double)
Applies Soft-NMS with linear decay.
public List<Detection<T>> ApplyLinear(List<Detection<T>> detections, double iouThreshold, double scoreThreshold = 0.001)
Parameters
detectionsList<Detection<T>>List of detections to filter.
iouThresholddoubleIoU threshold for applying decay.
scoreThresholddoubleMinimum score to keep a detection.