Calculate the union area between two polygon. Args: poly_det (Polygon): A polygon predicted by detector. poly_gt (Polygon): A gt polygon. Returns: union_area (float): The union area between two polygons.
(poly_det, poly_gt)
| 43 | |
| 44 | |
| 45 | def poly_union(poly_det, poly_gt): |
| 46 | """Calculate the union area between two polygon. |
| 47 | |
| 48 | Args: |
| 49 | poly_det (Polygon): A polygon predicted by detector. |
| 50 | poly_gt (Polygon): A gt polygon. |
| 51 | |
| 52 | Returns: |
| 53 | union_area (float): The union area between two polygons. |
| 54 | """ |
| 55 | assert isinstance(poly_det, Polygon) |
| 56 | assert isinstance(poly_gt, Polygon) |
| 57 | |
| 58 | area_det = poly_det.area |
| 59 | area_gt = poly_gt.area |
| 60 | area_inters, _ = poly_intersection(poly_det, poly_gt) |
| 61 | return area_det + area_gt - area_inters |
| 62 | |
| 63 | |
| 64 | def valid_boundary(x, with_score=True): |
no test coverage detected