提交 bfdb7b77 编写于 作者: T tink2123

change name for use_space_char

上级 db3d78d8
...@@ -15,7 +15,7 @@ Global: ...@@ -15,7 +15,7 @@ Global:
character_dict_path: ./ppocr/utils/ppocr_keys_v1.txt character_dict_path: ./ppocr/utils/ppocr_keys_v1.txt
loss_type: ctc loss_type: ctc
distort: false distort: false
add_sapce: false use_space_char: false
reader_yml: ./configs/rec/rec_chinese_reader.yml reader_yml: ./configs/rec/rec_chinese_reader.yml
pretrain_weights: pretrain_weights:
checkpoints: checkpoints:
......
...@@ -15,7 +15,7 @@ Global: ...@@ -15,7 +15,7 @@ Global:
character_dict_path: ./ppocr/utils/ppocr_keys_v1.txt character_dict_path: ./ppocr/utils/ppocr_keys_v1.txt
loss_type: ctc loss_type: ctc
distort: false distort: false
add_space: false use_space_char: false
reader_yml: ./configs/rec/rec_chinese_reader.yml reader_yml: ./configs/rec/rec_chinese_reader.yml
pretrain_weights: pretrain_weights:
checkpoints: checkpoints:
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
| character_dict_path | 设置字典路径 | ./ppocr/utils/ic15_dict.txt | \ | | character_dict_path | 设置字典路径 | ./ppocr/utils/ic15_dict.txt | \ |
| loss_type | 设置 loss 类型 | ctc | 支持两种loss: ctc / attention | | 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) | | 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 | \ | | reader_yml | 设置reader配置文件 | ./configs/rec/rec_icdar15_reader.yml | \ |
| pretrain_weights | 加载预训练模型路径 | ./pretrain_models/CRNN/best_accuracy | \ | | pretrain_weights | 加载预训练模型路径 | ./pretrain_models/CRNN/best_accuracy | \ |
| checkpoints | 加载模型参数路径 | None | 用于中断后加载参数继续训练 | | checkpoints | 加载模型参数路径 | None | 用于中断后加载参数继续训练 |
......
...@@ -31,7 +31,7 @@ Take `rec_chinese_lite_train.yml` as an example ...@@ -31,7 +31,7 @@ Take `rec_chinese_lite_train.yml` as an example
| character_dict_path | Set dictionary path | ./ppocr/utils/ic15_dict.txt | \ | | character_dict_path | Set dictionary path | ./ppocr/utils/ic15_dict.txt | \ |
| loss_type | Set loss type | ctc | Supports two types of loss: ctc / attention | | 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) | | 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 | \ | | 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 | \ | | 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 | | checkpoints | Load saved model path | None | Used to load saved parameters to continue training after interruption |
......
...@@ -31,8 +31,8 @@ class CharacterOps(object): ...@@ -31,8 +31,8 @@ class CharacterOps(object):
elif self.character_type == "ch": elif self.character_type == "ch":
character_dict_path = config['character_dict_path'] character_dict_path = config['character_dict_path']
add_space = False add_space = False
if 'add_space' in config: if 'use_space_char' in config:
add_space = config['add_space'] add_space = config['use_space_char']
self.character_str = "" self.character_str = ""
with open(character_dict_path, "rb") as fin: with open(character_dict_path, "rb") as fin:
lines = fin.readlines() lines = fin.readlines()
......
...@@ -40,7 +40,7 @@ class TextRecognizer(object): ...@@ -40,7 +40,7 @@ class TextRecognizer(object):
char_ops_params = { char_ops_params = {
"character_type": args.rec_char_type, "character_type": args.rec_char_type,
"character_dict_path": args.rec_char_dict_path, "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": if self.rec_algorithm != "RARE":
char_ops_params['loss_type'] = 'ctc' char_ops_params['loss_type'] = 'ctc'
......
...@@ -63,7 +63,7 @@ def parse_args(): ...@@ -63,7 +63,7 @@ def parse_args():
"--rec_char_dict_path", "--rec_char_dict_path",
type=str, type=str,
default="./ppocr/utils/ppocr_keys_v1.txt") 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() return parser.parse_args()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册