Skip to content

Box metrics

powerboxes.iou_distance(boxes1, boxes2)

Compute pairwise box iou distances.

Parameters:

Name Type Description Default
boxes1 NDArray[T]

2d array of boxes in xyxy format

required
boxes2 NDArray[T]

2d array of boxes in xyxy format

required

Raises:

Type Description
TypeError

if boxes1 or boxes2 are not numpy arrays

ValueError

if boxes1 and boxes2 have different dtypes

Returns:

Type Description
NDArray[float64]

np.ndarray: 2d matrix of pairwise distances

powerboxes.parallel_iou_distance(boxes1, boxes2)

Compute pairwise box iou distances, in parallel.

Parameters:

Name Type Description Default
boxes1 NDArray[T]

2d array of boxes in xyxy format

required
boxes2 NDArray[T]

2d array of boxes in xyxy format

required

Raises:

Type Description
TypeError

if boxes1 or boxes2 are not numpy arrays

ValueError

if boxes1 and boxes2 have different dtypes

Returns:

Type Description
NDArray[float64]

np.ndarray: 2d matrix of pairwise distances

powerboxes.giou_distance(boxes1, boxes2)

Compute pairwise box giou distances.

see here for giou distance definition

Parameters:

Name Type Description Default
boxes1 NDArray[T]

2d array of boxes in xyxy format

required
boxes2 NDArray[T]

2d array of boxes in xyxy format

required

Raises:

Type Description
TypeError

if boxes1 or boxes2 are not numpy arrays

ValueError

if boxes1 and boxes2 have different dtypes

Returns:

Type Description
NDArray[float64]

np.ndarray: 2d matrix of pairwise distances

powerboxes.parallel_giou_distance(boxes1, boxes2)

Compute pairwise box giou distances, in parallel.

see here for giou distance definition

Parameters:

Name Type Description Default
boxes1 NDArray[T]

2d array of boxes in xyxy format

required
boxes2 NDArray[T]

2d array of boxes in xyxy format

required

Raises:

Type Description
TypeError

if boxes1 or boxes2 are not numpy arrays

ValueError

if boxes1 and boxes2 have different dtypes

Returns:

Type Description
NDArray[float64]

np.ndarray: 2d matrix of pairwise distances

powerboxes.diou_distance(boxes1, boxes2)

Compute pairwise box diou distances.

DIoU distance is defined in https://arxiv.org/pdf/1911.08287.pdf

Parameters:

Name Type Description Default
boxes1 NDArray[Union[float32, float64]]

2d array of boxes in xyxy format

required
boxes2 NDArray[Union[float32, float64]]

2d array of boxes in xyxy format

required

Raises:

Type Description
TypeError

if boxes1 or boxes2 are not numpy arrays

ValueError

if boxes1 and boxes2 have different dtypes

Returns:

Type Description
NDArray[float64]

np.ndarray: 2d matrix of pairwise distances

powerboxes.tiou_distance(boxes1, boxes2)

Compute pairwise box tiou (tracking iou) distances.

see here for tiou definition

Parameters:

Name Type Description Default
boxes1 NDArray[T]

2d array of boxes in xyxy format

required
boxes2 NDArray[T]

2d array of boxes in xyxy format

required

Raises:

Type Description
TypeError

if boxes1 or boxes2 are not numpy arrays

ValueError

if boxes1 and boxes2 have different dtypes

Returns:

Type Description
NDArray[float64]

np.ndarray: 2d matrix of pairwise distances