MCPcopy Create free account
hub / github.com/OpenGVLab/HumanBench / pairwise_ioa

Function pairwise_ioa

PATH/core/models/ops/boxes.py:359–376  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

357
358
359def 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
379def pairwise_point_box_distance(points: torch.Tensor, boxes: Boxes):

Callers

nothing calls this directly

Calls 2

pairwise_intersectionFunction · 0.85
areaMethod · 0.45

Tested by

no test coverage detected