diff --git a/configs/rec/rec_r45_visionlan.yml b/configs/rec/rec_r45_visionlan.yml index f3a3661f5344f3c48b4948fb1037d185b94ad376..25017653a37941af07cfc3cfa092e17309c966b9 100644 --- a/configs/rec/rec_r45_visionlan.yml +++ b/configs/rec/rec_r45_visionlan.yml @@ -14,7 +14,7 @@ Global: use_visualdl: True infer_img: doc/imgs_words/en/word_2.png # for data or label process - character_dict_path: ppocr/utils/dict36.txt + character_dict_path: max_text_length: &max_text_length 25 training_step: &training_step LA infer_mode: False diff --git a/ppocr/data/imaug/label_ops.py b/ppocr/data/imaug/label_ops.py index 8acfd372f7a12e94c3afe698c04a9d8748d4d853..0698696a080017ca65679aab60ee7d987c90c824 100644 --- a/ppocr/data/imaug/label_ops.py +++ b/ppocr/data/imaug/label_ops.py @@ -1267,6 +1267,11 @@ class VLLabelEncode(BaseRecLabelEncode): **kwargs): super(VLLabelEncode, self).__init__( 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): text = data['label'] # original string diff --git a/ppocr/postprocess/rec_postprocess.py b/ppocr/postprocess/rec_postprocess.py index 0a3163721dc905c0e404b98dcacb9393788d078f..7b994f810d6747a91aceec82641f433d816b3feb 100644 --- a/ppocr/postprocess/rec_postprocess.py +++ b/ppocr/postprocess/rec_postprocess.py @@ -693,6 +693,8 @@ class VLLabelDecode(BaseRecLabelDecode): super(VLLabelDecode, self).__init__(character_dict_path, use_space_char) self.max_text_length = kwargs.get('max_text_length', 25) 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): """ convert text-index into text-label. """ diff --git a/ppocr/utils/dict36.txt b/ppocr/utils/dict36.txt deleted file mode 100644 index 6fe31360c462e2241625186cbc8dc3d461356fdc..0000000000000000000000000000000000000000 --- a/ppocr/utils/dict36.txt +++ /dev/null @@ -1,36 +0,0 @@ -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