paddleocr np.array(padding.Execute(distance)[0]) IndexError: list index out of range

x33g5p2x  于2022-02-07 转载在 其他  
字(0.6k)|赞(0)|评价(0)|浏览(371)

报错:

File "I:\project\jushi\shuini\PaddleOCR-release-2.4\ppocr\data\imaug\make_border_map.py", line 61, in __call__
    self.draw_border_map(text_polys[i], canvas, mask=mask)
  File "I:\project\jushi\shuini\PaddleOCR-release-2.4\ppocr\data\imaug\make_border_map.py", line 93, in draw_border_map
    padded_polygon = np.array(padding.Execute(distance)[0])
IndexError: list index out of range

原因:裁剪后,目标检测的多边形框变成了线,已经不能围成四边形了,但是面积是0.000000012

导致报错了,

临时解决方法:

改之前代码:

        polygon_shape = Polygon(polygon)
        if polygon_shape.area <= 0:
            return

改之后代码:

polygon_shape = Polygon(polygon)
        if polygon_shape.area <= 1:
            return

相关文章