From cb89544ca50aef77b77f2d41529c17557e001848 Mon Sep 17 00:00:00 2001 From: tink2123 Date: Thu, 8 Jul 2021 16:16:45 +0800 Subject: [PATCH] update shell --- test/ocr_rec_params.txt | 19 ++++++++++--------- test/prepare.sh | 30 +++++++++++++++++++----------- 2 files changed, 29 insertions(+), 20 deletions(-) diff --git a/test/ocr_rec_params.txt b/test/ocr_rec_params.txt index 7511296b..6ce081ec 100644 --- a/test/ocr_rec_params.txt +++ b/test/ocr_rec_params.txt @@ -1,13 +1,12 @@ model_name:ocr_rec -python:python3.7 +python:python gpu_list:0|0,1 -Global.auto_cast:False +Global.auto_cast:null Global.epoch_num:10 Global.save_model_dir:./output/ -Global.save_inference_dir:./output/ Train.loader.batch_size_per_card: -Global.use_gpu -Global.pretrained_model +Global.use_gpu: +Global.pretrained_model:null trainer:norm|pact norm_train:tools/train.py -c configs/rec/rec_mv3_none_bilstm_ctc.yml @@ -17,6 +16,8 @@ distill_train:null eval:tools/eval.py -c configs/rec/rec_mv3_none_bilstm_ctc.yml -o +Global.save_inference_dir:./output/ +Global.pretrained_model: norm_export:tools/export_model.py -c configs/rec/rec_mv3_none_bilstm_ctc.yml -o quant_export:deploy/slim/quantization/export_model.py -c configs/rec/rec_mv3_none_bilstm_ctc.yml -o fpgm_export:null @@ -26,9 +27,9 @@ inference:tools/infer/predict_rec.py --use_gpu:True|False --enable_mkldnn:True|False --cpu_threads:1|6 ---rec_batch_num:6 +--rec_batch_num:1 --use_tensorrt:True|False --precision:fp32|fp16|int8 ---rec_model_dir ---image_dir ---save_log_path \ No newline at end of file +--rec_model_dir:./inference/ch_ppocr_mobile_v2.0_rec_infer/ +--image_dir:./inference/rec_inference +--save_log_path:./test/output/ \ No newline at end of file diff --git a/test/prepare.sh b/test/prepare.sh index 15068246..e2427292 100644 --- a/test/prepare.sh +++ b/test/prepare.sh @@ -28,18 +28,22 @@ model_name=$(func_parser_value "${lines[0]}") train_model_list=$(func_parser_value "${lines[0]}") trainer_list=$(func_parser_value "${lines[10]}") +echo $train_model_list # MODE be one of ['lite_train_infer' 'whole_infer' 'whole_train_infer'] MODE=$2 -# prepare pretrained weights and dataset -wget -nc -P ./pretrain_models/ https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/MobileNetV3_large_x0_5_pretrained.pdparams -wget -nc -P ./pretrain_models/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/det_mv3_db_v2.0_train.tar -cd pretrain_models && tar xf det_mv3_db_v2.0_train.tar && cd ../ - +# prepare pretrained weights and dataset +if [ ${train_model_list[*]} = "ocr_det" ]; then + wget -nc -P ./pretrain_models/ https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/MobileNetV3_large_x0_5_pretrained.pdparams + wget -nc -P ./pretrain_models/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/det_mv3_db_v2.0_train.tar + cd pretrain_models && tar xf det_mv3_db_v2.0_train.tar && cd ../ + fi if [ ${MODE} = "lite_train_infer" ];then # pretrain lite train data rm -rf ./train_data/icdar2015 wget -nc -P ./train_data/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/icdar2015_lite.tar - cd ./train_data/ && tar xf icdar2015_lite.tar + wget -nc -P ./train_data/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/ic15_data.tar # todo change to bcebos + + cd ./train_data/ && tar xf icdar2015_lite.tar && tar xf ic15_data.tar ln -s ./icdar2015_lite ./icdar2015 cd ../ epoch=10 @@ -47,13 +51,15 @@ if [ ${MODE} = "lite_train_infer" ];then elif [ ${MODE} = "whole_train_infer" ];then rm -rf ./train_data/icdar2015 wget -nc -P ./train_data/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/icdar2015.tar - cd ./train_data/ && tar xf icdar2015.tar && cd ../ + wget -nc -P ./train_data/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/ic15_data.tar + cd ./train_data/ && tar xf icdar2015.tar && tar xf ic15_data.tar && cd ../ epoch=500 eval_batch_step=200 elif [ ${MODE} = "whole_infer" ];then rm -rf ./train_data/icdar2015 wget -nc -P ./train_data/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/icdar2015_infer.tar - cd ./train_data/ && tar xf icdar2015_infer.tar + wget -nc -P ./train_data/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/ic15_data.tar + cd ./train_data/ && tar xf icdar2015_infer.tar && tar xf ic15_data.tar ln -s ./icdar2015_infer ./icdar2015 cd ../ epoch=10 @@ -86,9 +92,11 @@ for train_model in ${train_model_list[*]}; do elif [ ${train_model} = "ocr_rec" ];then model_name="ocr_rec" yml_file="configs/rec/rec_mv3_none_bilstm_ctc.yml" - wget -nc -P ./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/ch_rec_data_200.tar - cd ./inference && tar xf ch_rec_data_200.tar && cd ../ - img_dir="./inference/ch_rec_data_200/" + wget -nc -P ./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/rec_inference.tar + cd ./inference && tar xf rec_inference.tar && cd ../ + img_dir="./inference/rec_inference/" + data_dir=./inference/rec_inference + data_label_file=[./inference/rec_inference/rec_gt_test.txt] fi # eval -- GitLab