From 0439dfb1129235f677ed92b4d605866d6a130879 Mon Sep 17 00:00:00 2001 From: littletomatodonkey Date: Mon, 21 Sep 2020 03:28:11 +0000 Subject: [PATCH] add yaml --- .../rec_chinese_common_train_v1.0.yml} | 0 .../rec_chinese_lite_train_v1.0.yml} | 0 .../rec_chinese_common_train_v1.1.yml | 52 ++++++++++++++++++ .../rec_chinese_lite_train_v1.1.yml | 54 +++++++++++++++++++ doc/doc_ch/quickstart.md | 3 +- 5 files changed, 107 insertions(+), 2 deletions(-) rename configs/rec/{rec_chinese_common_train.yml => ch_ppocr_v1.0/rec_chinese_common_train_v1.0.yml} (100%) rename configs/rec/{rec_chinese_lite_train.yml => ch_ppocr_v1.0/rec_chinese_lite_train_v1.0.yml} (100%) create mode 100644 configs/rec/ch_ppocr_v1.1/rec_chinese_common_train_v1.1.yml create mode 100755 configs/rec/ch_ppocr_v1.1/rec_chinese_lite_train_v1.1.yml diff --git a/configs/rec/rec_chinese_common_train.yml b/configs/rec/ch_ppocr_v1.0/rec_chinese_common_train_v1.0.yml similarity index 100% rename from configs/rec/rec_chinese_common_train.yml rename to configs/rec/ch_ppocr_v1.0/rec_chinese_common_train_v1.0.yml diff --git a/configs/rec/rec_chinese_lite_train.yml b/configs/rec/ch_ppocr_v1.0/rec_chinese_lite_train_v1.0.yml similarity index 100% rename from configs/rec/rec_chinese_lite_train.yml rename to configs/rec/ch_ppocr_v1.0/rec_chinese_lite_train_v1.0.yml diff --git a/configs/rec/ch_ppocr_v1.1/rec_chinese_common_train_v1.1.yml b/configs/rec/ch_ppocr_v1.1/rec_chinese_common_train_v1.1.yml new file mode 100644 index 00000000..8a84c635 --- /dev/null +++ b/configs/rec/ch_ppocr_v1.1/rec_chinese_common_train_v1.1.yml @@ -0,0 +1,52 @@ +Global: + algorithm: CRNN + use_gpu: true + epoch_num: 500 + log_smooth_window: 20 + print_batch_step: 10 + save_model_dir: ./output/rec_CRNN + save_epoch_step: 3 + eval_batch_step: 2000 + train_batch_size_per_card: 128 + test_batch_size_per_card: 128 + image_shape: [3, 32, 320] + max_text_length: 25 + character_type: ch + character_dict_path: ./ppocr/utils/ppocr_keys_v1.txt + loss_type: ctc + distort: true + use_space_char: true + reader_yml: ./configs/rec/rec_chinese_reader.yml + pretrain_weights: + checkpoints: + save_inference_dir: + infer_img: + +Architecture: + function: ppocr.modeling.architectures.rec_model,RecModel + +Backbone: + function: ppocr.modeling.backbones.rec_resnet_vd,ResNet + layers: 34 + +Head: + function: ppocr.modeling.heads.rec_ctc_head,CTCPredict + encoder_type: rnn + fc_decay: 0.00004 + SeqRNN: + hidden_size: 256 + +Loss: + function: ppocr.modeling.losses.rec_ctc_loss,CTCLoss + +Optimizer: + function: ppocr.optimizer,AdamDecay + base_lr: 0.0005 + l2_decay: 0.00004 + beta1: 0.9 + beta2: 0.999 + decay: + function: cosine_decay_warmup + step_each_epoch: 254 + total_epoch: 500 + warmup_minibatch: 1000 diff --git a/configs/rec/ch_ppocr_v1.1/rec_chinese_lite_train_v1.1.yml b/configs/rec/ch_ppocr_v1.1/rec_chinese_lite_train_v1.1.yml new file mode 100755 index 00000000..89333f89 --- /dev/null +++ b/configs/rec/ch_ppocr_v1.1/rec_chinese_lite_train_v1.1.yml @@ -0,0 +1,54 @@ +Global: + algorithm: CRNN + use_gpu: true + epoch_num: 500 + log_smooth_window: 20 + print_batch_step: 10 + save_model_dir: ./output/rec_CRNN + save_epoch_step: 3 + eval_batch_step: 2000 + train_batch_size_per_card: 256 + test_batch_size_per_card: 256 + image_shape: [3, 32, 320] + max_text_length: 25 + character_type: ch + character_dict_path: ./ppocr/utils/ppocr_keys_v1.txt + loss_type: ctc + distort: true + use_space_char: true + reader_yml: ./configs/rec/rec_chinese_reader.yml + pretrain_weights: + checkpoints: + save_inference_dir: + infer_img: + +Architecture: + function: ppocr.modeling.architectures.rec_model,RecModel + +Backbone: + function: ppocr.modeling.backbones.rec_mobilenet_v3,MobileNetV3 + scale: 0.5 + model_name: small + small_stride: [1, 2, 2, 2] + +Head: + function: ppocr.modeling.heads.rec_ctc_head,CTCPredict + encoder_type: rnn + fc_decay: 0.00001 + SeqRNN: + hidden_size: 48 + +Loss: + function: ppocr.modeling.losses.rec_ctc_loss,CTCLoss + +Optimizer: + function: ppocr.optimizer,AdamDecay + base_lr: 0.0005 + l2_decay: 0.00001 + beta1: 0.9 + beta2: 0.999 + decay: + function: cosine_decay_warmup + step_each_epoch: 254 + total_epoch: 500 + warmup_minibatch: 1000 diff --git a/doc/doc_ch/quickstart.md b/doc/doc_ch/quickstart.md index 6cfcc9ce..1dcb6337 100644 --- a/doc/doc_ch/quickstart.md +++ b/doc/doc_ch/quickstart.md @@ -63,7 +63,7 @@ cd .. ## 3.单张图像或者图像集合预测 -以下代码实现了文本检测、识别串联推理,在执行预测时,需要通过参数image_dir指定单张图像或者图像集合的路径、参数`det_model_dir`指定检测inference模型的路径、参数`rec_model_dir`指定识别inference模型的路径、参数`use_angle_cls`指定是否使用方向分类器、参数`cls_model_dir`指定方向分类器inference模型的路径、参数`use_space_char`指定是否使用空格数据。可视化识别结果默认保存到`./inference_results`文件夹里面。 +以下代码实现了文本检测、识别串联推理,在执行预测时,需要通过参数image_dir指定单张图像或者图像集合的路径、参数`det_model_dir`指定检测inference模型的路径、参数`rec_model_dir`指定识别inference模型的路径、参数`use_angle_cls`指定是否使用方向分类器、参数`cls_model_dir`指定方向分类器inference模型的路径、参数`use_space_char`指定是否预测空格字符。可视化识别结果默认保存到`./inference_results`文件夹里面。 ```bash @@ -74,7 +74,6 @@ python3 tools/infer/predict_system.py --image_dir="./doc/imgs/11.jpg" --det_mode python3 tools/infer/predict_system.py --image_dir="./doc/imgs/" --det_model_dir="./inference/ch_ppocr_mobile_v1.1_det_infer/" --rec_model_dir="./inference/ch_ppocr_mobile_v1.1_rec_infer/" --cls_model_dir="./inference/ch_ppocr_mobile_v1.1_cls_infer/" --use_angle_cls=True --use_space_char=True # 如果想使用CPU进行预测,需设置use_gpu参数为False - python3 tools/infer/predict_system.py --image_dir="./doc/imgs/11.jpg" --det_model_dir="./inference/ch_ppocr_mobile_v1.1_det_infer/" --rec_model_dir="./inference/ch_ppocr_mobile_v1.1_rec_infer/" --cls_model_dir="./inference/ch_ppocr_mobile_v1.1_cls_infer/" --use_angle_cls=True --use_space_char=True --use_gpu=False ``` -- GitLab