# nms

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

## 函数

### nms

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

非极大值抑制。

参数

 * `dets` (`np.ndarray`): 边界框和置信度分数。
 * `nms_thresh` (`float`): 非极大值抑制阈值。

返回

 * `list[int]`: 要保留的检测索引。

### nms_cv2

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

将 OpenCV 非极大值抑制应用于边界框。

参数

 * `bboxes` (`np.ndarray`): 形状为 `(N, 4)` 的数组，格式为 `[x, y, width, height]`。
 * `scores` (`np.ndarray`): 形状为 `(N,)` 的置信度分数。
 * `conf_threshold` (`float`): 用于过滤候选的得分阈值。
 * `iou_threshold` (`float`): 用于抑制的交并比阈值。
 * `max_det` (`int`): OpenCV 考虑的最大候选数。

返回

 * `list[int]`: * `保留框的索引，如果没有候选框，则返回空列表`。
