# nms

Python API: `depthai_nodes.node.utils.nms`

## Functions

| Name | Description |
| --- | --- |
| [`nms`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/node/utils/nms.md#nms-Functions-nms) | Perform Non-Maximum Suppression (NMS). |
| [`nms_detections`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/node/utils/nms.md#nms-Functions-nms_detections) | Apply non-maximum suppression independently to each detection class. |

### function `nms`

```python
def nms(boxes, scores, iou_thresh)
```

Perform Non-Maximum Suppression (NMS).

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `boxes` | `np.ndarray` | An ndarray of shape (N, 4), where each row is [xmin, ymin, xmax, ymax]. | required |
| `scores` | `np.ndarray` | An ndarray of shape (N,), containing the confidence scores for each box. | required |
| `iou_thresh` | `float` | The IoU threshold for Non-Maximum Suppression (NMS). | required |

Returns

| Type | Description |
| --- | --- |
| `list[int]` | A list of indices of the boxes to keep after applying NMS. |

### function `nms_detections`

```python
def nms_detections(detections: list[dai.ImgDetection], conf_thresh=0.3, iou_thresh=0.4)
```

Apply non-maximum suppression independently to each detection class.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `detections` | `list[dai.ImgDetection]` | Detections with normalized bounding boxes. | required |
| `conf_thresh` | `float` | Minimum confidence score to retain. | `0.3` |
| `iou_thresh` | `float` | Intersection-over-union threshold for suppression. | `0.4` |

Returns

 * `list[dai.ImgDetection]`: * `Detections that pass confidence filtering and`: per-class suppression.
