浏览代码

fix_shapely_error (#2723)

Sunflower7788 10 月之前
父节点
当前提交
ee04f1a697
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      paddlex/inference/pipelines_new/components/common/crop_image_regions.py

+ 2 - 0
paddlex/inference/pipelines_new/components/common/crop_image_regions.py

@@ -520,6 +520,8 @@ class CropByPolys(BaseOperator):
         def get_intersection(pD, pG):
             return Polygon(pD).intersection(Polygon(pG)).area
 
+        if not Polygon(points).is_valid:
+            return temp_crop_img
         cal_IoU = get_intersection_over_union(points, temp_box)
 
         if cal_IoU >= 0.7: