From 2a298fa4cfdafa589c54258deb4b2ca01ecf7373 Mon Sep 17 00:00:00 2001 From: LDOUBLEV Date: Wed, 13 May 2020 22:52:22 +0800 Subject: [PATCH] update det process code, +32 -> -32 --- ppocr/data/det/db_process.py | 8 ++++++-- ppocr/data/det/east_process.py | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ppocr/data/det/db_process.py b/ppocr/data/det/db_process.py index faca9ac2..80762c7c 100644 --- a/ppocr/data/det/db_process.py +++ b/ppocr/data/det/db_process.py @@ -143,12 +143,16 @@ class DBProcessTest(object): resize_w = int(resize_w * ratio) if resize_h % 32 == 0: resize_h = resize_h + elif resize_h // 32 <= 1: + resize_h = 32 else: - resize_h = (resize_h // 32 + 1) * 32 + resize_h = (resize_h // 32 - 1) * 32 if resize_w % 32 == 0: resize_w = resize_w + elif resize_w // 32 <= 1: + resize_w = 32 else: - resize_w = (resize_w // 32 + 1) * 32 + resize_w = (resize_w // 32 - 1) * 32 try: if int(resize_w) <= 0 or int(resize_h) <= 0: return None, (None, None) diff --git a/ppocr/data/det/east_process.py b/ppocr/data/det/east_process.py index 019eef57..5f52da4c 100755 --- a/ppocr/data/det/east_process.py +++ b/ppocr/data/det/east_process.py @@ -485,10 +485,14 @@ class EASTProcessTest(object): resize_w = int(resize_w * ratio) if resize_h % 32 == 0: resize_h = resize_h + elif resize_h // 32 <= 1: + resize_h = 32 else: resize_h = (resize_h // 32 - 1) * 32 if resize_w % 32 == 0: resize_w = resize_w + elif resize_w // 32 <= 1: + resize_w = 32 else: resize_w = (resize_w // 32 - 1) * 32 im = cv2.resize(im, (int(resize_w), int(resize_h))) -- GitLab