From e7187dac833ea95c3fa5681ddb4c736a3d526bab Mon Sep 17 00:00:00 2001 From: tink2123 Date: Mon, 8 Feb 2021 03:21:01 +0000 Subject: [PATCH 1/2] fix encode for srn --- ppocr/data/imaug/label_ops.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ppocr/data/imaug/label_ops.py b/ppocr/data/imaug/label_ops.py index 55870a5..6d40127 100644 --- a/ppocr/data/imaug/label_ops.py +++ b/ppocr/data/imaug/label_ops.py @@ -261,7 +261,7 @@ class SRNLabelEncode(BaseRecLabelEncode): if len(text) > self.max_text_len: return None data['length'] = np.array(len(text)) - text = text + [char_num] * (self.max_text_len - len(text)) + text = text + [char_num - 1] * (self.max_text_len - len(text)) data['label'] = np.array(text) return data From 1599a4590fd70d8bec2db3708d1d1a607cbc3aee Mon Sep 17 00:00:00 2001 From: tink2123 Date: Mon, 8 Feb 2021 03:30:27 +0000 Subject: [PATCH 2/2] fix attn encode --- ppocr/data/imaug/label_ops.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ppocr/data/imaug/label_ops.py b/ppocr/data/imaug/label_ops.py index 6d40127..7a32d87 100644 --- a/ppocr/data/imaug/label_ops.py +++ b/ppocr/data/imaug/label_ops.py @@ -215,7 +215,7 @@ class AttnLabelEncode(BaseRecLabelEncode): return None data['length'] = np.array(len(text)) text = [0] + text + [len(self.character) - 1] + [0] * (self.max_text_len - - len(text) - 1) + - len(text) - 2) data['label'] = np.array(text) return data