multi_class_non_max_suppression(boxlist: BoxList, score_thresh: float, iou_thresh: float, max_output_size: int) BoxList[source]#

Multi-class version of non maximum suppression.

This op greedily selects a subset of detection bounding boxes, pruning away boxes that have high IOU (intersection over union) overlap (> thresh) with already selected boxes. It operates independently for each class for which scores are provided (via the scores field of the input box_list), pruning boxes with score less than a provided threshold prior to applying NMS.

  • boxlist (BoxList) – A BoxList holding N boxes. Must contain a ‘scores’ field representing detection scores. This scores field is a tensor that can be 1 dimensional (in the case of a single class) or 2-dimensional, which which case we assume that it takes the shape [num_boxes, num_classes]. We further assume that this rank is known statically and that scores.shape[1] is also known (i.e., the number of classes is fixed and known at graph construction time).

  • score_thresh (float) – Scalar threshold for score (low scoring boxes are removed).

  • iou_thresh (float) – Scalar threshold for IOU (boxes that that high IOU overlap with previously selected boxes are removed).

  • max_output_size (int) – maximum number of retained boxes per class.


BoxList with M boxes with a rank-1 scores field representing

corresponding scores for each box with scores sorted in decreasing order and a rank-1 classes field representing a class label for each box.

Return type



ValueError – If iou_thresh is not in [0, 1] or if input boxlist does not have a valid scores field.