Merge pull request #3455 from thomaszheng/thomaszheng-patch-1

bug fix
This commit is contained in:
Double_V 2021-08-06 17:21:59 +08:00 committed by GitHub
commit 21b9bd6364
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -285,7 +285,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