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

Function box_ioa

PATH/core/models/ops/box_ops.py:23–32  ·  view source on GitHub ↗
(boxes1, boxes2)

Source from the content-addressed store, hash-verified

21
22
23def box_ioa(boxes1, boxes2):
24 area1 = box_area(boxes1)
25
26 lt = torch.max(boxes1[:, None, :2], boxes2[:, :2]) # [N,M,2]
27 rb = torch.min(boxes1[:, None, 2:], boxes2[:, 2:]) # [N,M,2]
28
29 wh = (rb - lt).clamp(min=0) # [N,M,2]
30 inter = wh[:, :, 0] * wh[:, :, 1] # [N,M]
31
32 return inter / area1[:, None]
33
34
35# modified from torchvision to also return the union

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected