Similar to :func:`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)
| 357 | |
| 358 | |
| 359 | def pairwise_ioa(boxes1: Boxes, boxes2: Boxes) -> torch.Tensor: |
| 360 | """ |
| 361 | Similar to :func:`pariwise_iou` but compute the IoA (intersection over boxes2 area). |
| 362 | |
| 363 | Args: |
| 364 | boxes1,boxes2 (Boxes): two `Boxes`. Contains N & M boxes, respectively. |
| 365 | |
| 366 | Returns: |
| 367 | Tensor: IoA, sized [N,M]. |
| 368 | """ |
| 369 | area2 = boxes2.area() # [M] |
| 370 | inter = pairwise_intersection(boxes1, boxes2) |
| 371 | |
| 372 | # handle empty boxes |
| 373 | ioa = torch.where( |
| 374 | inter > 0, inter / area2, torch.zeros(1, dtype=inter.dtype, device=inter.device) |
| 375 | ) |
| 376 | return ioa |
| 377 | |
| 378 | |
| 379 | def pairwise_point_box_distance(points: torch.Tensor, boxes: Boxes): |
nothing calls this directly
no test coverage detected