# nms

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

## 函数

### nms

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

执行非极大值抑制 (NMS)。

参数

 * `boxes` (`np.ndarray`): 形状为 (N, 4) 的 ndarray，其中每一行是 [xmin, ymin, xmax, ymax]。
 * `scores` (`np.ndarray`): 形状为 (N,) 的 ndarray，包含每个框的置信度分数。
 * `iou_thresh` (`float`): 非极大值抑制 (NMS) 的 IoU 阈值。

返回

 * `list[int]`: 应用 NMS 后要保留的框的索引列表。

### nms_detections

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

独立地对每个检测类别应用非极大值抑制。

参数

 * `detections` (`list[dai.ImgDetection]`): 带有归一化边界框的检测。
 * `conf_thresh` (`float`): 要保留的最小置信度分数。
 * `iou_thresh` (`float`): 用于抑制的交并比阈值。

返回

 * `list[dai.ImgDetection]`: * 通过置信度过滤和每类抑制的检测。
