Versioned name: NonMaxSuppression-5
Category: Sorting and maximization
Short description: NonMaxSuppression performs non maximum suppression of the boxes with predicted scores.
Detailed description: NonMaxSuppression performs non maximum suppression algorithm as described below:
B = [b_0,...,b_n]
be the list of initial detection boxes, S = [s_0,...,s_N]
be the list of corresponding scores.D = []
be an initial collection of resulting boxes.B
is empty then go to step 8.b
with the score s
.b
from B
.s
is greater or equal than score_threshold
then add b
to D
else go to step 8.b_i
from B
and the corresponding score s_i
, set s_i = s_i * func(IOU(b_i, b))
and go to step 3.D
, a collection of the corresponding scores S
, and the number of elements in D
.Here func(iou) = 1 if iou <= iou_threshold else 0
when soft_nms_sigma == 0
, else func(iou) = exp(-0.5 * iou * iou / soft_nms_sigma) if iou <= iou_threshold else 0
.
This algorithm is applied independently to each class of each batch element. The total number of output boxes for each class must not exceed max_output_boxes_per_class
.
Attributes:
[y1, x1, y2, x2]
where (y1, x1)
and (y2, x2)
are the coordinates of any diagonal pair of box corners.[x_center, y_center, width, height]
.Inputs:
boxes
- tensor of type T and shape [num_batches, num_boxes, 4]
with box coordinates. Required.scores
- tensor of type T and shape [num_batches, num_classes, num_boxes]
with box scores. Required.max_output_boxes_per_class
- scalar or 1D tensor with 1 element of type T_MAX_BOXES specifying maximum number of boxes to be selected per class. Optional with default value 0 meaning select no boxes.iou_threshold
- scalar or 1D tensor with 1 element of type T_THRESHOLDS specifying intersection over union threshold. Optional with default value 0 meaning keep all boxes.score_threshold
- scalar or 1D tensor with 1 element of type T_THRESHOLDS specifying minimum score to consider box for the processing. Optional with default value 0.soft_nms_sigma
- scalar or 1D tensor with 1 element of type T_THRESHOLDS specifying the sigma parameter for Soft-NMS; see Bodla et al. Optional with default value 0.Outputs:
selected_indices
- tensor of type T_IND and shape [number of selected boxes, 3]
containing information about selected boxes as triplets [batch_index, class_index, box_index]
.selected_scores
- tensor of type T_THRESHOLDS and shape [number of selected boxes, 3]
containing information about scores for each selected box as triplets [batch_index, class_index, box_score]
.valid_outputs
- 1D tensor with 1 element of type T_IND representing the total number of selected boxes.Plugins which do not support dynamic output tensors produce selected_indices
and selected_scores
tensors of shape [min(num_boxes, max_output_boxes_per_class) * num_batches * num_classes, 3]
which is an upper bound for the number of possible selected boxes. Output tensor elements following the really selected boxes are filled with value -1.
Types
int64
or int32
.Example