batched_nms¶
- torchvision.ops.batched_nms(boxes: Tensor, scores: Tensor, idxs: Tensor, iou_threshold: float) Tensor [源代码]¶
以批处理的方式执行非极大值抑制(non-maximum suppression)。
每个索引值对应一个类别,并且不会在不同类别的元素之间应用 NMS。
- 参数:
boxes (Tensor[N, 4]) – 将执行 NMS 的框。它们应为
(x1, y1, x2, y2)
格式,其中0 <= x1 < x2
和0 <= y1 < y2
。scores (Tensor[N]) – 每个框的分数
idxs (Tensor[N]) – 每个框的类别的索引。
iou_threshold (float) – 丢弃所有 IoU > iou_threshold 的重叠框
- 返回:
int64 类型的张量,包含由 NMS 保留的元素的索引,按分数降序排列
- 返回类型:
张量