此页面由 AI 自动翻译。查看英文原版
最后更新

本页目录

  • 函数
  • nms
  • nms_cv2
Claude CodeCodexCursor
Luxonis 智能体工具包为你常用的编程智能体加载 Luxonis 上下文与技能,更快地基于 OAK 开发应用。
安装工具包
最后更新
Python API: depthai_nodes.node.parsers.utils.nms

函数

nms

Python
1def nms(dets: np.ndarray, nms_thresh: float = 0.5) -> list[int]:
非极大值抑制。参数
  • dets (np.ndarray): 边界框和置信度分数。
  • nms_thresh (float): 非极大值抑制阈值。
返回
  • list[int]: 要保留的检测索引。

nms_cv2

Python
1def 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]:
    • 保留框的索引,如果没有候选框,则返回空列表。