Similar to pariwise_iou but compute the IoA (intersection over boxes2 area). Args: boxes1,boxes2 (Boxes): two `Boxes`. Contains N & M boxes, respectively. Returns: Tensor: IoA, sized [N,M].
(boxes1: Boxes, boxes2: Boxes)
| 369 | |
| 370 | |
| 371 | def pairwise_ioa(boxes1: Boxes, boxes2: Boxes) -> torch.Tensor: |
| 372 | """ |
| 373 | Similar to pariwise_iou but compute the IoA (intersection over boxes2 area). |
| 374 | |
| 375 | Args: |
| 376 | boxes1,boxes2 (Boxes): two `Boxes`. Contains N & M boxes, respectively. |
| 377 | |
| 378 | Returns: |
| 379 | Tensor: IoA, sized [N,M]. |
| 380 | """ |
| 381 | area2 = boxes2.area() # [M] |
| 382 | inter = pairwise_intersection(boxes1, boxes2) |
| 383 | |
| 384 | # handle empty boxes |
| 385 | ioa = torch.where( |
| 386 | inter > 0, inter / area2, torch.zeros(1, dtype=inter.dtype, device=inter.device) |
| 387 | ) |
| 388 | return ioa |
| 389 | |
| 390 | |
| 391 | def matched_boxlist_iou(boxes1: Boxes, boxes2: Boxes) -> torch.Tensor: |
nothing calls this directly
no test coverage detected