From bfdb7b7781b8beccb6f0f7cb4e00991097f9fcca Mon Sep 17 00:00:00 2001 From: tink2123 Date: Tue, 7 Jul 2020 14:29:45 +0800 Subject: [PATCH] change name for use_space_char --- configs/rec/rec_chinese_common_train.yml | 2 +- configs/rec/rec_chinese_lite_train.yml | 2 +- doc/doc_ch/config.md | 2 +- doc/doc_en/config_en.md | 2 +- ppocr/utils/character.py | 4 ++-- tools/infer/predict_rec.py | 2 +- tools/infer/utility.py | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/configs/rec/rec_chinese_common_train.yml b/configs/rec/rec_chinese_common_train.yml index 72728bd2..0d897459 100644 --- a/configs/rec/rec_chinese_common_train.yml +++ b/configs/rec/rec_chinese_common_train.yml @@ -15,7 +15,7 @@ Global: character_dict_path: ./ppocr/utils/ppocr_keys_v1.txt loss_type: ctc distort: false - add_sapce: false + use_space_char: false reader_yml: ./configs/rec/rec_chinese_reader.yml pretrain_weights: checkpoints: diff --git a/configs/rec/rec_chinese_lite_train.yml b/configs/rec/rec_chinese_lite_train.yml index adc6d696..95a39a3b 100755 --- a/configs/rec/rec_chinese_lite_train.yml +++ b/configs/rec/rec_chinese_lite_train.yml @@ -15,7 +15,7 @@ Global: character_dict_path: ./ppocr/utils/ppocr_keys_v1.txt loss_type: ctc distort: false - add_space: false + use_space_char: false reader_yml: ./configs/rec/rec_chinese_reader.yml pretrain_weights: checkpoints: diff --git a/doc/doc_ch/config.md b/doc/doc_ch/config.md index 66ab2342..6ef69d9c 100644 --- a/doc/doc_ch/config.md +++ b/doc/doc_ch/config.md @@ -31,7 +31,7 @@ | character_dict_path | 设置字典路径 | ./ppocr/utils/ic15_dict.txt | \ | | loss_type | 设置 loss 类型 | ctc | 支持两种loss: ctc / attention | | distort | 设置是否使用数据增强 | false | 设置为true时,将在训练时随机进行扰动,支持的扰动操作可阅读[img_tools.py](https://github.com/PaddlePaddle/PaddleOCR/blob/develop/ppocr/data/rec/img_tools.py) | -| add_space | 设置是否识别空格 | false | 仅在"ch"模式下支持空格 | +| use_space_char | 设置是否识别空格 | false | 仅在"ch"模式下支持空格 | | reader_yml | 设置reader配置文件 | ./configs/rec/rec_icdar15_reader.yml | \ | | pretrain_weights | 加载预训练模型路径 | ./pretrain_models/CRNN/best_accuracy | \ | | checkpoints | 加载模型参数路径 | None | 用于中断后加载参数继续训练 | diff --git a/doc/doc_en/config_en.md b/doc/doc_en/config_en.md index aab1b9a3..827d8b23 100644 --- a/doc/doc_en/config_en.md +++ b/doc/doc_en/config_en.md @@ -31,7 +31,7 @@ Take `rec_chinese_lite_train.yml` as an example | character_dict_path | Set dictionary path | ./ppocr/utils/ic15_dict.txt | \ | | loss_type | Set loss type | ctc | Supports two types of loss: ctc / attention | | distort | Set use distort | false | Support distort type ,read [img_tools.py](https://github.com/PaddlePaddle/PaddleOCR/blob/develop/ppocr/data/rec/img_tools.py) | -| add_space | Wether to recognize space | false | Only support in "ch" mode | +| use_space_char | Wether to recognize space | false | Only support in "ch" mode | | reader_yml | Set the reader configuration file | ./configs/rec/rec_icdar15_reader.yml | \ | | pretrain_weights | Load pre-trained model path | ./pretrain_models/CRNN/best_accuracy | \ | | checkpoints | Load saved model path | None | Used to load saved parameters to continue training after interruption | diff --git a/ppocr/utils/character.py b/ppocr/utils/character.py index 26b1ba77..5d852852 100755 --- a/ppocr/utils/character.py +++ b/ppocr/utils/character.py @@ -31,8 +31,8 @@ class CharacterOps(object): elif self.character_type == "ch": character_dict_path = config['character_dict_path'] add_space = False - if 'add_space' in config: - add_space = config['add_space'] + if 'use_space_char' in config: + add_space = config['use_space_char'] self.character_str = "" with open(character_dict_path, "rb") as fin: lines = fin.readlines() diff --git a/tools/infer/predict_rec.py b/tools/infer/predict_rec.py index 3be013ed..bd96548d 100755 --- a/tools/infer/predict_rec.py +++ b/tools/infer/predict_rec.py @@ -40,7 +40,7 @@ class TextRecognizer(object): char_ops_params = { "character_type": args.rec_char_type, "character_dict_path": args.rec_char_dict_path, - "add_space": args.rec_add_space + "use_space_char": args.use_space_char } if self.rec_algorithm != "RARE": char_ops_params['loss_type'] = 'ctc' diff --git a/tools/infer/utility.py b/tools/infer/utility.py index bbd130d1..88a84fae 100755 --- a/tools/infer/utility.py +++ b/tools/infer/utility.py @@ -63,7 +63,7 @@ def parse_args(): "--rec_char_dict_path", type=str, default="./ppocr/utils/ppocr_keys_v1.txt") - parser.add_argument("--rec_add_space", type=bool, default=True) + parser.add_argument("--use_space_char", type=bool, default=True) return parser.parse_args() -- GitLab