捷徑

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 < x20 <= y1 < y2

  • scores (Tensor[N]) – 每個邊界框的分數

  • idxs (Tensor[N]) – 每個邊界框的類別索引。

  • iou_threshold (float) – 捨棄所有 IoU > iou_threshold 的重疊邊界框

返回值:

int64 張量,包含 NMS 保留的元素的索引,並依分數降序排列

返回類型:

Tensor

文件

存取 PyTorch 的完整開發者文件

檢視文件

教學

取得初學者和進階開發者的深入教學

檢視教學

資源

尋找開發資源並獲得問題解答

檢視資源