Skip to content

Commit 1b1f170

Browse files
authored
Merge pull request #1979 from tink2123/fix_encode
Fix encode for srn and attn
2 parents a3afc16 + 1599a45 commit 1b1f170

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ppocr/data/imaug/label_ops.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ def __call__(self, data):
215215
return None
216216
data['length'] = np.array(len(text))
217217
text = [0] + text + [len(self.character) - 1] + [0] * (self.max_text_len
218-
- len(text) - 1)
218+
- len(text) - 2)
219219
data['label'] = np.array(text)
220220
return data
221221

@@ -261,7 +261,7 @@ def __call__(self, data):
261261
if len(text) > self.max_text_len:
262262
return None
263263
data['length'] = np.array(len(text))
264-
text = text + [char_num] * (self.max_text_len - len(text))
264+
text = text + [char_num - 1] * (self.max_text_len - len(text))
265265
data['label'] = np.array(text)
266266
return data
267267

0 commit comments

Comments
 (0)