From 89ddde94dc6a09e62764df160b0f7fc8127fe7a0 Mon Sep 17 00:00:00 2001 From: zclzc <38581401+lkevinzc@users.noreply.github.com> Date: Sun, 6 Sep 2020 12:06:19 +0800 Subject: [PATCH] Update img_tools.py Fix bug when training with grayscale --- ppocr/data/rec/img_tools.py | 1 + 1 file changed, 1 insertion(+) diff --git a/ppocr/data/rec/img_tools.py b/ppocr/data/rec/img_tools.py index 8b497e6b..9230ee5e 100755 --- a/ppocr/data/rec/img_tools.py +++ b/ppocr/data/rec/img_tools.py @@ -40,6 +40,7 @@ def resize_norm_img(img, image_shape): resized_image = cv2.resize(img, (resized_w, imgH)) resized_image = resized_image.astype('float32') if image_shape[0] == 1: + resized_image = cv2.cvtColor(resized_image, cv2.COLOR_BGR2GRAY) resized_image = resized_image / 255 resized_image = resized_image[np.newaxis, :] else: -- GitLab