diff --git a/configs/rec/rec_chinese_common_train.yml b/configs/rec/rec_chinese_common_train.yml index 72728bd21391134f1fea40af032dc72064c0f257..0d897459e0a631a4ac1fa10973f18e8640078c1b 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 adc6d69699cdc7b8b5e8de59d794c175a4ae0a51..95a39a3b4d349973356594e15a23f951e27dc7c5 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 66ab23423cb8a219d9322108df22c9ad267a67aa..6ef69d9cb0cc7ab4ed6d072185d734b12af1e30a 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 aab1b9a33ad86d1f4465971badf43905f18c03f8..827d8b23b6f2855bf379058f117cfdb3a26885e6 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 26b1ba77884faec115d7c8b8754ebc2ed10411d3..5d852852c38a1486e031e6f45d529608a4a17e4a 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 3be013ed33d109aeb42ea676b9edee5fc46f1c93..bd96548d827d7b47a059648e8cedc20086488801 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 bbd130d1a699238fe16fce4db283a6374060a3c4..88a84faec135baa092c40499823cc07af1803cc0 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()