diff --git a/ppocr/data/det/db_process.py b/ppocr/data/det/db_process.py index cdb8efc2bd9028ff5fc004f13b6505db5d74328c..b64b8c8d227f293aff0eff90d1d85dee8dd85fce 100644 --- a/ppocr/data/det/db_process.py +++ b/ppocr/data/det/db_process.py @@ -194,8 +194,12 @@ class DBProcessTest(object): img_std = [0.229, 0.224, 0.225] im = im.astype(np.float32, copy=False) im = im / 255 - im -= img_mean - im /= img_std + im[:, :, 0] -= img_mean[0] + im[:, :, 1] -= img_mean[1] + im[:, :, 2] -= img_mean[2] + im[:, :, 0] /= img_std[0] + im[:, :, 1] /= img_std[1] + im[:, :, 2] /= img_std[2] channel_swap = (2, 0, 1) im = im.transpose(channel_swap) return im diff --git a/ppocr/data/rec/img_tools.py b/ppocr/data/rec/img_tools.py index 76c4315a887db11f6d543666d08b0ed60ebce698..d41abd9ba5c867853984b4b3b4c9eda41ebeff7c 100755 --- a/ppocr/data/rec/img_tools.py +++ b/ppocr/data/rec/img_tools.py @@ -360,7 +360,7 @@ def process_image(img, text = char_ops.encode(label) if len(text) == 0 or len(text) > max_text_length: logger.info( - "Warning in ppocr/data/rec/img_tools.py:line106: Wrong data type." + "Warning in ppocr/data/rec/img_tools.py:line362: Wrong data type." "Excepted string with length between 1 and {}, but " "got '{}'. Label is '{}'".format(max_text_length, len(text), label))