提交 3380010d 编写于 作者: A andyjpaddle

update dict

上级 cad04bbb
...@@ -14,7 +14,7 @@ Global: ...@@ -14,7 +14,7 @@ Global:
use_visualdl: True use_visualdl: True
infer_img: doc/imgs_words/en/word_2.png infer_img: doc/imgs_words/en/word_2.png
# for data or label process # for data or label process
character_dict_path: ppocr/utils/dict36.txt character_dict_path:
max_text_length: &max_text_length 25 max_text_length: &max_text_length 25
training_step: &training_step LA training_step: &training_step LA
infer_mode: False infer_mode: False
......
...@@ -1267,6 +1267,11 @@ class VLLabelEncode(BaseRecLabelEncode): ...@@ -1267,6 +1267,11 @@ class VLLabelEncode(BaseRecLabelEncode):
**kwargs): **kwargs):
super(VLLabelEncode, self).__init__( super(VLLabelEncode, self).__init__(
max_text_length, character_dict_path, use_space_char, lower) max_text_length, character_dict_path, use_space_char, lower)
self.character = self.character[10:] + self.character[
1:10] + [self.character[0]]
self.dict = {}
for i, char in enumerate(self.character):
self.dict[char] = i
def __call__(self, data): def __call__(self, data):
text = data['label'] # original string text = data['label'] # original string
......
...@@ -693,6 +693,8 @@ class VLLabelDecode(BaseRecLabelDecode): ...@@ -693,6 +693,8 @@ class VLLabelDecode(BaseRecLabelDecode):
super(VLLabelDecode, self).__init__(character_dict_path, use_space_char) super(VLLabelDecode, self).__init__(character_dict_path, use_space_char)
self.max_text_length = kwargs.get('max_text_length', 25) self.max_text_length = kwargs.get('max_text_length', 25)
self.nclass = len(self.character) + 1 self.nclass = len(self.character) + 1
self.character = self.character[10:] + self.character[
1:10] + [self.character[0]]
def decode(self, text_index, text_prob=None, is_remove_duplicate=False): def decode(self, text_index, text_prob=None, is_remove_duplicate=False):
""" convert text-index into text-label. """ """ convert text-index into text-label. """
......
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
1
2
3
4
5
6
7
8
9
0
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册