MCPcopy Create free account
hub / github.com/EmbodiedGPT/EmbodiedGPT_Pytorch / iou

Function iou

demo/script.py:71–83  ·  view source on GitHub ↗
(box1, box2)

Source from the content-addressed store, hash-verified

69DEFAULT_VIDEO_END_TOKEN = "</vid>"
70
71def iou(box1, box2):
72 # 计算交集
73 x1 = max(box1[0], box2[0])
74 y1 = max(box1[1], box2[1])
75 x2 = min(box1[2], box2[2])
76 y2 = min(box1[3], box2[3])
77
78 intersection = max(0, x2 - x1) * max(0, y2 - y1)
79 box1_area = (box1[2] - box1[0]) * (box1[3] - box1[1])
80 box2_area = (box2[2] - box2[0]) * (box2[3] - box2[1])
81 union = box1_area + box2_area - intersection
82
83 return intersection / union if union != 0 else 0
84
85
86def show_predictions(scores, boxes, classes):

Callers 1

reduce_boxesMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected