From 3f824f00bc74e16bfc25186b994579db6a59b29c Mon Sep 17 00:00:00 2001 From: LDOUBLEV Date: Fri, 10 Jul 2020 10:40:10 +0800 Subject: [PATCH] modify normalization of db_process to speed up --- ppocr/data/det/db_process.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ppocr/data/det/db_process.py b/ppocr/data/det/db_process.py index cdb8efc2..b64b8c8d 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