From eb96c623b8d2a6f3b6e973c76f5b0349546f36bc Mon Sep 17 00:00:00 2001 From: LDOUBLEV Date: Fri, 27 Aug 2021 06:46:40 +0000 Subject: [PATCH 1/6] set benchmark in predict_system --- tools/infer/predict_system.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/infer/predict_system.py b/tools/infer/predict_system.py index eae0e27c..6e7f6902 100755 --- a/tools/infer/predict_system.py +++ b/tools/infer/predict_system.py @@ -173,7 +173,9 @@ def main(args): logger.info("The predict total time is {}".format(time.time() - _st)) logger.info("\nThe predict total time is {}".format(total_time)) - + if args.benchmark: + text_sys.text_detector.autolog.report() + text_sys.text_recognizer.autolog.report() if __name__ == "__main__": args = utility.parse_args() From cf16859919b574aea5c8f55022135bea875f3da6 Mon Sep 17 00:00:00 2001 From: LDOUBLEV Date: Fri, 27 Aug 2021 06:48:27 +0000 Subject: [PATCH 2/6] set benchmark in predict_system --- tools/infer/predict_system.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/infer/predict_system.py b/tools/infer/predict_system.py index 6e7f6902..b5edd015 100755 --- a/tools/infer/predict_system.py +++ b/tools/infer/predict_system.py @@ -177,6 +177,7 @@ def main(args): text_sys.text_detector.autolog.report() text_sys.text_recognizer.autolog.report() + if __name__ == "__main__": args = utility.parse_args() if args.use_mp: From 3133ff28d9e8e37d628c899464d8eedc76885215 Mon Sep 17 00:00:00 2001 From: LDOUBLEV Date: Fri, 27 Aug 2021 07:03:13 +0000 Subject: [PATCH 3/6] add ocr_system --- tests/prepare.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/prepare.sh b/tests/prepare.sh index 5da74d94..6e329b65 100644 --- a/tests/prepare.sh +++ b/tests/prepare.sh @@ -72,6 +72,11 @@ elif [ ${MODE} = "infer" ] || [ ${MODE} = "cpp_infer" ];then wget -nc -P ./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_server_v2.0_det_infer.tar wget -nc -P ./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/ch_det_data_50.tar cd ./inference && tar xf ch_ppocr_server_v2.0_det_infer.tar && tar xf ch_det_data_50.tar && cd ../ + elif [ ${model_name} = "ocr_system" ]; then + wget -nc -P ./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_det_infer.tar + wget -nc -P ./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/ch_det_data_50.tar + wget -nc -P ./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_rec_infer.tar + cd ./inference && tar xf ch_ppocr_mobile_v2.0_det_infer.tar && tar xf ch_ppocr_mobile_v2.0_rec_infer.tar && tar xf ch_det_data_50.tar && cd ../ else rm -rf ./train_data/ic15_data eval_model_name="ch_ppocr_mobile_v2.0_rec_infer" @@ -149,4 +154,4 @@ if [ ${MODE} = "cpp_infer" ];then make -j echo "################### build PaddleOCR demo finished ###################" -fi \ No newline at end of file +fi From aa210b9d6241845013ca0458671ea2ae711c4661 Mon Sep 17 00:00:00 2001 From: LDOUBLEV Date: Fri, 27 Aug 2021 07:03:36 +0000 Subject: [PATCH 4/6] add tests/ppocr_mobile_params.txt --- tests/ppocr_mobile_params.txt | 67 +++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 tests/ppocr_mobile_params.txt diff --git a/tests/ppocr_mobile_params.txt b/tests/ppocr_mobile_params.txt new file mode 100644 index 00000000..7f0e6559 --- /dev/null +++ b/tests/ppocr_mobile_params.txt @@ -0,0 +1,67 @@ +===========================train_params=========================== +model_name:ocr_system +python:python3.7 +gpu_list:null +Global.use_gpu:null +Global.auto_cast:null +Global.epoch_num:null +Global.save_model_dir:./output/ +Train.loader.batch_size_per_card:null +Global.pretrained_model:null +train_model_name:null +train_infer_img_dir:null +null:null +## +trainer: +norm_train:null +pact_train:null +fpgm_train:null +distill_train:null +null:null +null:null +## +===========================eval_params=========================== +eval:null +null:null +## +===========================infer_params=========================== +Global.save_inference_dir:./output/ +Global.pretrained_model: +norm_export:null +quant_export:null +fpgm_export:null +distill_export:null +export1:null +export2:null +## +infer_model:./inference/ch_ppocr_mobile_v2.0_det_infer/ +infer_export:null +infer_quant:False +inference:tools/infer/predict_system.py +--use_gpu:True +--enable_mkldnn:True|False +--cpu_threads:1|6 +--rec_batch_num:1 +--use_tensorrt:False|True +--precision:fp32|fp16|int8 +--det_model_dir: +--image_dir:./inference/ch_det_data_50/all-sum-510/ +--save_log_path:null +--benchmark:True +--rec_model_dir:./inference/ch_ppocr_mobile_v2.0_rec_infer/ +===========================cpp_infer_params=========================== +use_opencv:True +infer_model:./inference/ch_ppocr_mobile_v2.0_det_infer/ +infer_quant:False +inference:./deploy/cpp_infer/build/ppocr det +--use_gpu:True|False +--enable_mkldnn:True|False +--cpu_threads:1|6 +--rec_batch_num:1 +--use_tensorrt:False|True +--precision:fp32|fp16 +--det_model_dir: +--image_dir:./inference/ch_det_data_50/all-sum-510/ +--save_log_path:null +--benchmark:True + From 11d9169c2b580d8bbbe54c09e4d69cac4835c050 Mon Sep 17 00:00:00 2001 From: LDOUBLEV Date: Fri, 27 Aug 2021 07:04:52 +0000 Subject: [PATCH 5/6] rename ppocr_mobile_params.txt --- tests/1 | 67 +++++++++++++++++++ ...params.txt => ocr_ppocr_mobile_params.txt} | 0 2 files changed, 67 insertions(+) create mode 100644 tests/1 rename tests/{ppocr_mobile_params.txt => ocr_ppocr_mobile_params.txt} (100%) diff --git a/tests/1 b/tests/1 new file mode 100644 index 00000000..bb237f79 --- /dev/null +++ b/tests/1 @@ -0,0 +1,67 @@ +===========================train_params=========================== +model_name:ocr_det +python:python3.7 +gpu_list:0|0,1 +Global.use_gpu:True|True +Global.auto_cast:null +Global.epoch_num:lite_train_infer=1|whole_train_infer=300 +Global.save_model_dir:./output/ +Train.loader.batch_size_per_card:lite_train_infer=2|whole_train_infer=4 +Global.pretrained_model:null +train_model_name:latest +train_infer_img_dir:./train_data/icdar2015/text_localization/ch4_test_images/ +null:null +## +trainer:norm_train|pact_train|fpgm_train +norm_train:tools/train.py -c configs/det/det_mv3_db.yml -o Global.pretrained_model=./pretrain_models/MobileNetV3_large_x0_5_pretrained +pact_train:deploy/slim/quantization/quant.py -c configs/det/det_mv3_db.yml -o +fpgm_train:deploy/slim/prune/sensitivity_anal.py -c configs/det/det_mv3_db.yml -o Global.pretrained_model=./pretrain_models/det_mv3_db_v2.0_train/best_accuracy +distill_train:null +null:null +null:null +## +===========================eval_params=========================== +eval:tools/eval.py -c configs/det/det_mv3_db.yml -o +null:null +## +===========================infer_params=========================== +Global.save_inference_dir:./output/ +Global.pretrained_model: +norm_export:tools/export_model.py -c configs/det/det_mv3_db.yml -o +quant_export:deploy/slim/quantization/export_model.py -c configs/det/det_mv3_db.yml -o +fpgm_export:deploy/slim/prune/export_prune_model.py -c configs/det/det_mv3_db.yml -o +distill_export:null +export1:null +export2:null +## +infer_model:./inference/ch_ppocr_mobile_v2.0_det_infer/ +infer_export:null +infer_quant:False +inference:tools/infer/predict_system.py +--use_gpu:True|False +--enable_mkldnn:True|False +--cpu_threads:1|6 +--rec_batch_num:1 +--use_tensorrt:False|True +--precision:fp32|fp16|int8 +--det_model_dir: +--image_dir:./inference/ch_det_data_50/all-sum-510/ +--save_log_path:null +--benchmark:True +--rec_model_dir:./inference/ch_ppocr_mobile_v2.0_rec_infer/ +===========================cpp_infer_params=========================== +use_opencv:True +infer_model:./inference/ch_ppocr_mobile_v2.0_det_infer/ +infer_quant:False +inference:./deploy/cpp_infer/build/ppocr det +--use_gpu:True|False +--enable_mkldnn:True|False +--cpu_threads:1|6 +--rec_batch_num:1 +--use_tensorrt:False|True +--precision:fp32|fp16 +--det_model_dir: +--image_dir:./inference/ch_det_data_50/all-sum-510/ +--save_log_path:null +--benchmark:True + diff --git a/tests/ppocr_mobile_params.txt b/tests/ocr_ppocr_mobile_params.txt similarity index 100% rename from tests/ppocr_mobile_params.txt rename to tests/ocr_ppocr_mobile_params.txt From 35449b5c7440f7706e5a4558e5b3efeb76944432 Mon Sep 17 00:00:00 2001 From: LDOUBLEV Date: Fri, 27 Aug 2021 07:05:06 +0000 Subject: [PATCH 6/6] rename ppocr_mobile_params.txt --- tests/1 | 67 --------------------------------------------------------- 1 file changed, 67 deletions(-) delete mode 100644 tests/1 diff --git a/tests/1 b/tests/1 deleted file mode 100644 index bb237f79..00000000 --- a/tests/1 +++ /dev/null @@ -1,67 +0,0 @@ -===========================train_params=========================== -model_name:ocr_det -python:python3.7 -gpu_list:0|0,1 -Global.use_gpu:True|True -Global.auto_cast:null -Global.epoch_num:lite_train_infer=1|whole_train_infer=300 -Global.save_model_dir:./output/ -Train.loader.batch_size_per_card:lite_train_infer=2|whole_train_infer=4 -Global.pretrained_model:null -train_model_name:latest -train_infer_img_dir:./train_data/icdar2015/text_localization/ch4_test_images/ -null:null -## -trainer:norm_train|pact_train|fpgm_train -norm_train:tools/train.py -c configs/det/det_mv3_db.yml -o Global.pretrained_model=./pretrain_models/MobileNetV3_large_x0_5_pretrained -pact_train:deploy/slim/quantization/quant.py -c configs/det/det_mv3_db.yml -o -fpgm_train:deploy/slim/prune/sensitivity_anal.py -c configs/det/det_mv3_db.yml -o Global.pretrained_model=./pretrain_models/det_mv3_db_v2.0_train/best_accuracy -distill_train:null -null:null -null:null -## -===========================eval_params=========================== -eval:tools/eval.py -c configs/det/det_mv3_db.yml -o -null:null -## -===========================infer_params=========================== -Global.save_inference_dir:./output/ -Global.pretrained_model: -norm_export:tools/export_model.py -c configs/det/det_mv3_db.yml -o -quant_export:deploy/slim/quantization/export_model.py -c configs/det/det_mv3_db.yml -o -fpgm_export:deploy/slim/prune/export_prune_model.py -c configs/det/det_mv3_db.yml -o -distill_export:null -export1:null -export2:null -## -infer_model:./inference/ch_ppocr_mobile_v2.0_det_infer/ -infer_export:null -infer_quant:False -inference:tools/infer/predict_system.py ---use_gpu:True|False ---enable_mkldnn:True|False ---cpu_threads:1|6 ---rec_batch_num:1 ---use_tensorrt:False|True ---precision:fp32|fp16|int8 ---det_model_dir: ---image_dir:./inference/ch_det_data_50/all-sum-510/ ---save_log_path:null ---benchmark:True ---rec_model_dir:./inference/ch_ppocr_mobile_v2.0_rec_infer/ -===========================cpp_infer_params=========================== -use_opencv:True -infer_model:./inference/ch_ppocr_mobile_v2.0_det_infer/ -infer_quant:False -inference:./deploy/cpp_infer/build/ppocr det ---use_gpu:True|False ---enable_mkldnn:True|False ---cpu_threads:1|6 ---rec_batch_num:1 ---use_tensorrt:False|True ---precision:fp32|fp16 ---det_model_dir: ---image_dir:./inference/ch_det_data_50/all-sum-510/ ---save_log_path:null ---benchmark:True -