fix AttnLabelEncode out of max_text_len

This commit is contained in:
thomaszheng 2021-07-28 16:47:36 +08:00 committed by GitHub
parent 25f30acb29
commit 0bca14593d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -283,7 +283,7 @@ class AttnLabelEncode(BaseRecLabelEncode):
text = self.encode(text) text = self.encode(text)
if text is None: if text is None:
return None return None
if len(text) >= self.max_text_len: if len(text) >= self.max_text_len - 1:
return None return None
data['length'] = np.array(len(text)) data['length'] = np.array(len(text))
text = [0] + text + [len(self.character) - 1] + [0] * (self.max_text_len text = [0] + text + [len(self.character) - 1] + [0] * (self.max_text_len