batched_nms¶
- torchvision.ops.batched_nms(boxes: Tensor, scores: Tensor, idxs: Tensor, iou_threshold: float) Tensor [源代码]¶
以批处理方式执行非极大值抑制。
每个索引值对应一个类别,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 保留的元素的索引,按分数降序排列
- 返回类型:
Tensor