MCPcopy Create free account
hub / github.com/Topdu/OpenOCR / poly_iou

Function poly_iou

tools/utils/poly_nms.py:94–110  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

92
93
94def 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
113def poly_nms(polygons, threshold):

Callers 1

boundary_iouFunction · 0.85

Calls 2

poly_intersectionFunction · 0.85
poly_unionFunction · 0.85

Tested by

no test coverage detected