From 0bca14593d7f93bc7372c6f19b23c2c7d3591ee1 Mon Sep 17 00:00:00 2001 From: thomaszheng Date: Wed, 28 Jul 2021 16:47:36 +0800 Subject: [PATCH] fix AttnLabelEncode out of max_text_len --- 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 bba3209f..72af5e59 100644 --- a/ppocr/data/imaug/label_ops.py +++ b/ppocr/data/imaug/label_ops.py @@ -283,7 +283,7 @@ class AttnLabelEncode(BaseRecLabelEncode): text = self.encode(text) if text is None: return None - if len(text) >= self.max_text_len: + if len(text) >= self.max_text_len - 1: return None data['length'] = np.array(len(text)) text = [0] + text + [len(self.character) - 1] + [0] * (self.max_text_len