Calculate the IOU between two polygons. Args: poly_det (Polygon): A polygon predicted by detector. poly_gt (Polygon): A gt polygon. Returns: iou (float): The IOU between two polygons.
(poly_det, poly_gt)
| 92 | |
| 93 | |
| 94 | def poly_iou(poly_det, poly_gt): |
| 95 | """Calculate the IOU between two polygons. |
| 96 | |
| 97 | Args: |
| 98 | poly_det (Polygon): A polygon predicted by detector. |
| 99 | poly_gt (Polygon): A gt polygon. |
| 100 | |
| 101 | Returns: |
| 102 | iou (float): The IOU between two polygons. |
| 103 | """ |
| 104 | assert isinstance(poly_det, Polygon) |
| 105 | assert isinstance(poly_gt, Polygon) |
| 106 | area_inters, _ = poly_intersection(poly_det, poly_gt) |
| 107 | area_union = poly_union(poly_det, poly_gt) |
| 108 | if area_union == 0: |
| 109 | return 0.0 |
| 110 | return area_inters / area_union |
| 111 | |
| 112 | |
| 113 | def poly_nms(polygons, threshold): |
no test coverage detected