From 37e3bc16990913bc6d0f7fcc1354736efef3fddf Mon Sep 17 00:00:00 2001 From: OneYearIsEnough <81819512+OneYearIsEnough@users.noreply.github.com> Date: Sun, 1 May 2022 20:04:20 +0800 Subject: [PATCH] [Patch] Add stability in training stage (#5378) * [Patch] Add stability in training stage * [Patch] Add stability in training stage --- ppocr/data/imaug/operators.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ppocr/data/imaug/operators.py b/ppocr/data/imaug/operators.py index daa67a25..fd9513bc 100644 --- a/ppocr/data/imaug/operators.py +++ b/ppocr/data/imaug/operators.py @@ -35,11 +35,14 @@ class DecodeImage(object): def __call__(self, data): img = data['image'] if six.PY2: - assert type(img) is str and len( - img) > 0, "invalid input 'img' in DecodeImage" + if not (type(img) is str and len(img) > 0): + print("invalid input 'img' in DecodeImage, continue") + return None else: - assert type(img) is bytes and len( - img) > 0, "invalid input 'img' in DecodeImage" + if not (type(img) is bytes and len(img) > 0): + print("invalid input 'img' in DecodeImage, continue") + return None + img = np.frombuffer(img, dtype='uint8') img = cv2.imdecode(img, 1) if img is None: -- GitLab