From 61b2556694883e94a91e4f91e1aa76a23227efd0 Mon Sep 17 00:00:00 2001 From: WZMIAOMIAO <605169423@qq.com> Date: Thu, 30 Dec 2021 15:27:52 +0800 Subject: [PATCH] fix a bug --- ppocr/data/imaug/make_border_map.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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()