(rect1, rect2, iob_threshold)
| 124 | |
| 125 | |
| 126 | def IoU(rect1, rect2, iob_threshold): |
| 127 | a1 = (rect1[:, 2] - rect1[:, 0] + 1) * (rect1[:, 3] - rect1[:, 1] + 1) |
| 128 | a2 = (rect2[:, 2] - rect2[:, 0] + 1) * (rect2[:, 3] - rect2[:, 1] + 1) |
| 129 | xx1 = np.maximum(rect1[:, 0], rect2[:, 0]) |
| 130 | yy1 = np.maximum(rect1[:, 1], rect2[:, 1]) |
| 131 | xx2 = np.minimum(rect1[:, 2], rect2[:, 2]) |
| 132 | yy2 = np.minimum(rect1[:, 3], rect2[:, 3]) |
| 133 | dx = np.maximum(0, xx2 - xx1 + 1) |
| 134 | dy = np.maximum(0, yy2 - yy1 + 1) |
| 135 | i = dx * dy |
| 136 | |
| 137 | ov = i / (a1 + a2 - i) |
| 138 | ov[a1 + a2 - i < 0] = 0 |
| 139 | return ov |
| 140 | |
| 141 | |
| 142 | def simple_merge(rect1, rect2): |
nothing calls this directly
no outgoing calls
no test coverage detected