nonMaximumSuppression

fun nonMaximumSuppression(iou: Float, scores: Tensor, boxes: Tensor, scoresResult: Tensor? = null, boxesResult: Tensor? = null, indicesResult: Tensor? = null)

Run non-maximum-suppression (NMS) on 2D bounding boxes.

Parameters

iou

a configuration value, determining the intersection-over-union threshold when the non-maximum suppression is run.

scores

the input tensor holding the scores for each bounding box. The tensor must be of 32-/64-bit float data type and must not be a scene graph tensor. It must be a multi-dimensional one with dimensions = Nx1 and channel = 1, where N is the number of input bounding boxes.

boxes

the input tensor holding the box boundaries. The boundaries are expected to be expressed in XXYY format. The tensor must be a multi-dimensional tensor of 4 channels, with dimensions = Nx1 or 1xN, or a multi-dimensional tensor of 1 channel, with dimensions = Nx4, where N is the number of input bounding boxes and must match that of scores. The data type must be 32-/64-bit float.

scoresResult

an optional result, holding first M scores of bounding boxes passed NMS, sorted from highest to lowest. The tensor, if provided, must be a multi-dimensional tensor of 1 channel, with dimensions = Mx1. The data type must be 32-64-bit float.

boxesResult

an optional result, holding first M bounding boxes passed NMS, sorted from the highest score to the lowest, matching the scores output from scoresResult. The tensor, if provided, must be a multi-dimensional tensor of 4 channels, with dimensions = Mx1, or a multi-dimensional tensor of 1 channel, with dimensions = Mx4. The data type must be 32-/64-bit float.

indicesResult

an optional result, holding the original indices in the boxes input of the first M bounding boxes passed NMS , sorted by the bounding boxes' scores, from the highest to the lowest, matching the scores and boxes output from scoresResult and boxesResult. The tensor, if provided, must be a multi-dimensional tensor of 1 channel, with dimensions = Mx1, or 1xM. The data type must be one of the integral types.

Throws

If the usage is not allowed by the SpatialML run-time Framework, or if the framework encounter internal error and cannot perform the requested behavior.