From 33f302e5ff0e2b893a9b4d1c712e98fe3e5e5d84 Mon Sep 17 00:00:00 2001 From: WenmuZhou Date: Tue, 9 Feb 2021 13:36:38 +0800 Subject: [PATCH 1/2] support img_h < 32 --- ppocr/data/imaug/operators.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ppocr/data/imaug/operators.py b/ppocr/data/imaug/operators.py index 8b9175cf0b..eacfdf3b24 100644 --- a/ppocr/data/imaug/operators.py +++ b/ppocr/data/imaug/operators.py @@ -185,8 +185,8 @@ class DetResizeForTest(object): resize_h = int(h * ratio) resize_w = int(w * ratio) - resize_h = int(round(resize_h / 32) * 32) - resize_w = int(round(resize_w / 32) * 32) + resize_h = max(int(round(resize_h / 32) * 32), 32) + resize_w = max(int(round(resize_w / 32) * 32), 32) try: if int(resize_w) <= 0 or int(resize_h) <= 0: From 0507402a0f8522d582263c48fdde4630e235e24d Mon Sep 17 00:00:00 2001 From: WenmuZhou Date: Fri, 19 Feb 2021 16:29:54 +0800 Subject: [PATCH 2/2] fix export bug --- ppocr/modeling/heads/rec_att_head.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ppocr/modeling/heads/rec_att_head.py b/ppocr/modeling/heads/rec_att_head.py index 59e26c1e20..0d222714ff 100644 --- a/ppocr/modeling/heads/rec_att_head.py +++ b/ppocr/modeling/heads/rec_att_head.py @@ -57,6 +57,9 @@ class AttentionHead(nn.Layer): else: targets = paddle.zeros(shape=[batch_size], dtype="int32") probs = None + char_onehots = None + outputs = None + alpha = None for i in range(num_steps): char_onehots = self._char_to_onehot( @@ -146,9 +149,6 @@ class AttentionLSTM(nn.Layer): else: targets = paddle.zeros(shape=[batch_size], dtype="int32") probs = None - char_onehots = None - outputs = None - alpha = None for i in range(num_steps): char_onehots = self._char_to_onehot(