box_iou¶ torchvision.ops.box_iou(boxes1: Tensor, boxes2: Tensor) → Tensor[source]¶ 返回两组框之间的交并比 (Jaccard 指数)。 两组框都应为 (x1, y1, x2, y2) 格式,其中 0 <= x1 < x2 且 0 <= y1 < y2。 参数: boxes1 (Tensor[N, 4]) – 第一组框 boxes2 (Tensor[M, 4]) – 第二组框 返回: 包含 boxes1 和 boxes2 中每对元素之间成对 IoU 值的 NxM 矩阵 返回类型: Tensor[N, M]