batched_nms¶
- torchvision.ops.batched_nms(boxes: Tensor, scores: Tensor, idxs: Tensor, iou_threshold: float) Tensor[source]¶
以批處理方式執行非極大值抑制。
每個索引值對應一個類別,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 保留元素的索引,按分數降序排序
- 返回型別:
張量