or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

annotators.mdcoordinate-conversion.mdcore-data-structures.mddataset-management.mddetection-tools.mddrawing-colors.mdfile-utilities.mdindex.mdiou-nms.mdkeypoint-annotators.mdmetrics.mdtracking.mdvideo-processing.mdvlm-support.md

iou-nms.mddocs/

0

# IOU and NMS Operations

1

2

Intersection over Union calculations and Non-Maximum Suppression algorithms for filtering and merging detection results.

3

4

## Capabilities

5

6

### IOU Calculation

7

8

```python { .api }

9

def box_iou(boxes_true: np.ndarray, boxes_detection: np.ndarray) -> np.ndarray:

10

"""Calculate IoU between two sets of boxes."""

11

12

def box_iou_batch(boxes_true: np.ndarray, boxes_detection: np.ndarray) -> np.ndarray:

13

"""Batch IoU calculation between box sets."""

14

15

def mask_iou_batch(masks_true: np.ndarray, masks_detection: np.ndarray) -> np.ndarray:

16

"""Calculate IoU between segmentation masks."""

17

18

def oriented_box_iou_batch(boxes_true: np.ndarray, boxes_detection: np.ndarray) -> np.ndarray:

19

"""IoU calculation for oriented bounding boxes."""

20

```

21

22

### Non-Maximum Suppression

23

24

```python { .api }

25

def box_non_max_suppression(predictions: np.ndarray, iou_threshold: float = 0.5) -> np.ndarray:

26

"""Apply NMS to remove overlapping boxes."""

27

28

def mask_non_max_suppression(predictions: np.ndarray, masks: np.ndarray, iou_threshold: float = 0.5) -> np.ndarray:

29

"""Apply NMS using mask IoU."""

30

31

def box_non_max_merge(predictions: np.ndarray, iou_threshold: float = 0.5) -> np.ndarray:

32

"""Merge overlapping boxes instead of suppressing."""

33

34

class OverlapMetric(Enum):

35

IOU = "iou"

36

IOS = "ios"

37

38

class OverlapFilter(Enum):

39

NMS = "nms"

40

NMM = "nmm"

41

```