MCPcopy Create free account
hub / github.com/Depth2World/VLADBench / box_iou

Function box_iou

evaluate_utils.py:32–48  ·  view source on GitHub ↗
(boxA, boxB)

Source from the content-addressed store, hash-verified

30
31
32def box_iou(boxA, boxB):
33 boxA = [int(x) for x in boxA]
34 boxB = [int(x) for x in boxB]
35
36 xA = max(boxA[0], boxB[0])
37 xB = min(boxA[2], boxB[2])
38 yA = max(boxA[1], boxB[1])
39 yB = min(boxA[3], boxB[3])
40
41 interArea = max(0, xB - xA + 1) * max(0, yB - yA + 1)
42
43 boxAArea = (boxA[2] - boxA[0] + 1) * (boxA[3] - boxA[1] + 1)
44 boxBArea = (boxB[2] - boxB[0] + 1) * (boxB[3] - boxB[1] + 1)
45
46 iou = interArea / float(boxAArea + boxBArea - interArea)
47
48 return iou
49def clean_string(s):
50 while s and (s[0] in ":[]()' ."):
51 s = s[1:]

Callers 1

Grounding_criterion_QAFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected