← 返回 meta 的题目列表Calculate Intersection over Union (IoU) for Bounding Boxes
类型:online_judge
meta
Given two bounding boxes defined by their top-left and bottom-right coordinates (x1, y1, x2, y2), compute the Intersection over Union (IoU) of the two bounding boxes. The IoU is defined as the area of overlap divided by the area of union of the two bounding boxes. Example input: box1 = [0, 0, 2, 2], box2 = [1, 1, 3, 3] Output: 0.1429 (rounded to four decimal places).
Example
Input
[0, 0, 2, 2]
[1, 1, 3, 3]