Skip to content

Box filtering

powerboxes.remove_small_boxes(boxes, min_size)

Remove boxes with area less than min_area.

Parameters:

Name Type Description Default
boxes NDArray[T]

2d array of boxes in xyxy format

required
min_size float

minimum area of boxes to keep

required

Raises:

Type Description
TypeError

if boxes is not numpy array

Returns:

Type Description
NDArray[T]

np.ndarray: 2d array of boxes in xyxy format

powerboxes.nms(boxes, scores, iou_threshold, score_threshold)

Apply non-maximum suppression to boxes.

Parameters:

Name Type Description Default
boxes NDArray[T]

2d array of boxes in xyxy format

required
scores NDArray[float64]

1d array of scores

required
iou_threshold float

threshold for iou

required
score_threshold float

threshold for scores

required

Raises:

Type Description
TypeError

if boxes or scores are not numpy arrays

Returns:

Type Description
NDArray[uint64]

npt.NDArray[np.uint64]: 1d array of indices to keep

powerboxes.rtree_nms(boxes, scores, iou_threshold, score_threshold)

Apply non-maximum suppression to boxes.

Uses an rtree to speed up computation. This is only available for signed integer dtypes and float32 and float64.

Parameters:

Name Type Description Default
boxes NDArray[Union[float64, float32, int64, int32, int16]]

2d array of boxes in xyxy format

required
scores NDArray[float64]

1d array of scores

required
iou_threshold float

threshold for iou

required
score_threshold float

threshold for scores

required

Raises:

Type Description
TypeError

if boxes or scores are not numpy arrays

Returns:

Type Description
NDArray[uint64]

npt.NDArray[np.uint64]: 1d array of indices to keep