MCPcopy Create free account
hub / github.com/PeizeSun/SparseR-CNN / pairwise_ioa

Function pairwise_ioa

detectron2/structures/boxes.py:371–388  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

369
370
371def 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
391def matched_boxlist_iou(boxes1: Boxes, boxes2: Boxes) -> torch.Tensor:

Callers

nothing calls this directly

Calls 2

pairwise_intersectionFunction · 0.85
areaMethod · 0.45

Tested by

no test coverage detected