# nms

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

## Functions

| Name | Description |
| --- | --- |
| [`nms`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/node/parsers/utils/nms.md#nms-Functions-nms) | Non-maximum suppression. |
| [`nms_cv2`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/node/parsers/utils/nms.md#nms-Functions-nms_cv2) | Apply OpenCV non-maximum suppression to bounding boxes. |

### function `nms`

```python
def nms(dets: np.ndarray, nms_thresh: float = 0.5) -> list[int]
```

Non-maximum suppression.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `dets` | `np.ndarray` | Bounding boxes and confidence scores. | required |
| `nms_thresh` | `float` | Non-maximum suppression threshold. | `0.5` |

Returns

| Type | Description |
| --- | --- |
| `list[int]` | Indices of the detections to keep. |

### function `nms_cv2`

```python
def nms_cv2(
    bboxes: np.ndarray,
    scores: np.ndarray,
    conf_threshold: float,
    iou_threshold: float,
    max_det: int,
)
```

Apply OpenCV non-maximum suppression to bounding boxes.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `bboxes` | `np.ndarray` | Array of shape `(N, 4)` in `[x, y, width, height]` format. | required |
| `scores` | `np.ndarray` | Confidence scores of shape `(N,)`. | required |
| `conf_threshold` | `float` | Score threshold for filtering candidates. | required |
| `iou_threshold` | `float` | Intersection-over-union threshold for suppression. | required |
| `max_det` | `int` | Maximum number of candidates considered by OpenCV. | required |

Returns

 * `list[int]`: * `Indices of the retained boxes, or an empty list when there are no`: candidates.
