diff --git a/ppocr/data/imaug/make_border_map.py b/ppocr/data/imaug/make_border_map.py index abab38368d..39650c629d 100644 --- a/ppocr/data/imaug/make_border_map.py +++ b/ppocr/data/imaug/make_border_map.py @@ -78,7 +78,10 @@ def draw_border_map(self, polygon, canvas, mask): padding = pyclipper.PyclipperOffset() padding.AddPath(subject, pyclipper.JT_ROUND, pyclipper.ET_CLOSEDPOLYGON) - padded_polygon = np.array(padding.Execute(distance)[0]) + result = padding.Execute(distance) + if len(result) == 0: + return + padded_polygon = np.array(result[0]) cv2.fillPoly(mask, [padded_polygon.astype(np.int32)], 1.0) xmin = padded_polygon[:, 0].min()