From 72b453b9d1232fc7b2736309823f8574314e011a Mon Sep 17 00:00:00 2001 From: xxxpsyduck Date: Fri, 19 Jun 2020 13:31:12 +0700 Subject: [PATCH 1/2] make sure all images are RGB --- ppocr/data/det/dataset_traversal.py | 5 +---- ppocr/data/det/db_process.py | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/ppocr/data/det/dataset_traversal.py b/ppocr/data/det/dataset_traversal.py index 16866b0e86..737cbe2e90 100644 --- a/ppocr/data/det/dataset_traversal.py +++ b/ppocr/data/det/dataset_traversal.py @@ -97,11 +97,8 @@ class EvalTestReader(object): if img is None: logger.info("{} does not exist!".format(img_path)) continue - if len(list(img.shape)) == 2 or img.shape[2] == 1: + elif len(list(img.shape)) == 2 or img.shape[2] == 1: img = cv2.cvtColor(img, cv2.COLOR_GRAY2BGR) - if img is None: - logger.info("load image error:" + img_path) - continue outs = process_function(img) outs.append(img_path) batch_outs.append(outs) diff --git a/ppocr/data/det/db_process.py b/ppocr/data/det/db_process.py index ee13150172..72c9acd921 100644 --- a/ppocr/data/det/db_process.py +++ b/ppocr/data/det/db_process.py @@ -104,7 +104,7 @@ class DBProcessTrain(object): if imgvalue is None: logger.info("{} does not exist!".format(img_path)) return None - if len(list(imgvalue.shape)) == 2 or imgvalue.shape[2] == 1: + elif len(list(imgvalue.shape)) == 2 or imgvalue.shape[2] == 1: imgvalue = cv2.cvtColor(imgvalue, cv2.COLOR_GRAY2BGR) data = self.make_data_dict(imgvalue, gt_label) data = AugmentData(data) From 98c80f161ae8067d9d5a500b912f7ab01c3a4f14 Mon Sep 17 00:00:00 2001 From: xxxpsyduck Date: Fri, 19 Jun 2020 13:39:58 +0700 Subject: [PATCH 2/2] revert change in db_process.py --- ppocr/data/det/db_process.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ppocr/data/det/db_process.py b/ppocr/data/det/db_process.py index 72c9acd921..ee13150172 100644 --- a/ppocr/data/det/db_process.py +++ b/ppocr/data/det/db_process.py @@ -104,7 +104,7 @@ class DBProcessTrain(object): if imgvalue is None: logger.info("{} does not exist!".format(img_path)) return None - elif len(list(imgvalue.shape)) == 2 or imgvalue.shape[2] == 1: + if len(list(imgvalue.shape)) == 2 or imgvalue.shape[2] == 1: imgvalue = cv2.cvtColor(imgvalue, cv2.COLOR_GRAY2BGR) data = self.make_data_dict(imgvalue, gt_label) data = AugmentData(data)