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 保留的元素的索引,並依分數降序排列
- 返回類型:
Tensor