(box1, box2)
| 182 | return (box[2] - box[0]) * (box[3] - box[1]) |
| 183 | |
| 184 | def intersection_area(box1, box2): |
| 185 | x1 = max(box1[0], box2[0]) |
| 186 | y1 = max(box1[1], box2[1]) |
| 187 | x2 = min(box1[2], box2[2]) |
| 188 | y2 = min(box1[3], box2[3]) |
| 189 | return max(0, x2 - x1) * max(0, y2 - y1) |
| 190 | |
| 191 | def IoU(box1, box2): |
| 192 | intersection = intersection_area(box1, box2) |