Merge pull request #1979 from tink2123/fix_encode

Fix encode for srn and attn
This commit is contained in:
xiaoting 2021-02-08 11:35:23 +08:00 committed by GitHub
commit 1b1f170c7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -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
@ -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