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

Function poly_union

tools/utils/poly_nms.py:45–61  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

43
44
45def 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
64def valid_boundary(x, with_score=True):

Callers 1

poly_iouFunction · 0.85

Calls 1

poly_intersectionFunction · 0.85

Tested by

no test coverage detected