(rect1, rect2, iou_threshold)
| 95 | |
| 96 | |
| 97 | def is_overlap_v1(rect1, rect2, iou_threshold): |
| 98 | xx1 = max(rect1[0], rect2[0]) |
| 99 | yy1 = max(rect1[1], rect2[1]) |
| 100 | xx2 = min(rect1[2], rect2[2]) |
| 101 | yy2 = min(rect1[3], rect2[3]) |
| 102 | dx = max(0, xx2 - xx1 + 1) |
| 103 | dy = max(0, yy2 - yy1 + 1) |
| 104 | i = dx * dy |
| 105 | u = (rect1[2] - rect1[0] + 1) * (rect1[3] - rect1[1] + 1) + ( |
| 106 | rect2[2] - rect2[0] + 1) * (rect2[3] - rect2[1] + 1) - i |
| 107 | ov = i / u |
| 108 | return ov >= iou_threshold |
| 109 | |
| 110 | |
| 111 | def IoB(rect1, rect2, iob_threshold): |