(rect1, rect2)
| 76 | |
| 77 | |
| 78 | def cal_iou(rect1, rect2): |
| 79 | x1, y1, x2, y2 = rect1 |
| 80 | x3, y3, x4, y4 = rect2 |
| 81 | i_w = min(x2, x4) - max(x1, x3) |
| 82 | i_h = min(y2, y4) - max(y1, y3) |
| 83 | if(i_w <= 0 or i_h <= 0): |
| 84 | return 0 |
| 85 | i_s = i_w * i_h |
| 86 | s_1 = (x2 - x1) * (y2 - y1) |
| 87 | s_2 = (x4 - x3) * (y4 - y3) |
| 88 | return float(i_s) / (s_1 + s_2 - i_s) |
| 89 | |
| 90 | def cal_simi(det_rect1, det_rect2): |
| 91 | return cal_iou(det_rect1.next_rect, det_rect2.curr_rect) |
no outgoing calls
no test coverage detected