diff --git a/configs/det/det_r50_vd_sast_icdar15.yml b/configs/det/det_r50_vd_sast_icdar15.yml index 674de7fbf250bd712b46e04d42ff0022029fd095..e1bf6fad0c4f526c2b635494560446e779bdb572 100755 --- a/configs/det/det_r50_vd_sast_icdar15.yml +++ b/configs/det/det_r50_vd_sast_icdar15.yml @@ -106,4 +106,4 @@ Eval: shuffle: False drop_last: False batch_size_per_card: 1 # must be 1 - num_workers: 2 \ No newline at end of file + num_workers: 2 diff --git a/test_tipc/configs/jeston_ppocr_det_mobile_params.txt b/test_tipc/configs/jeston_ppocr_det_mobile_params.txt deleted file mode 100644 index 7e2bba2462bc4517f13da35a6a3bb527275bb85f..0000000000000000000000000000000000000000 --- a/test_tipc/configs/jeston_ppocr_det_mobile_params.txt +++ /dev/null @@ -1,51 +0,0 @@ -===========================train_params=========================== -model_name:ocr_det -python:python -gpu_list:null -Global.use_gpu:null -Global.auto_cast:null -Global.epoch_num:null -Global.save_model_dir:null -Train.loader.batch_size_per_card:null -Global.pretrained_model:null -train_model_name:latest -train_infer_img_dir:null -null:null -## -trainer:null -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:null -norm_export:null -quant_export:null -fpgm_export:null -distill_export:null -export1:null -export2:null -inference_dir:null -train_model:./inference/ch_ppocr_mobile_v2.0_det_infer -infer_export:null -infer_quant:False -inference:tools/infer/predict_det.py ---use_gpu:True|False ---enable_mkldnn:False ---cpu_threads:1|6 ---rec_batch_num:1 ---use_tensorrt:False|True ---precision:fp16|fp32 ---det_model_dir: ---image_dir:./inference/ch_det_data_50/all-sum-510/ -null:null ---benchmark:True -null:null diff --git a/test_tipc/configs/ppocr_det_mobile/model_linux_gpu_normal_normal_infer_python_jetson.txt b/test_tipc/configs/ppocr_det_mobile/model_linux_gpu_normal_normal_infer_python_jetson.txt index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..7d3f60bd42aad18c045aeee70fc60d2c17a2af13 100644 --- a/test_tipc/configs/ppocr_det_mobile/model_linux_gpu_normal_normal_infer_python_jetson.txt +++ b/test_tipc/configs/ppocr_det_mobile/model_linux_gpu_normal_normal_infer_python_jetson.txt @@ -0,0 +1,18 @@ +===========================infer_params=========================== +model_name:ocr_det +python:python +infer_model:./inference/ch_ppocr_mobile_v2.0_det_infer +infer_export:null +infer_quant:False +inference:tools/infer/predict_det.py +--use_gpu:True|False +--enable_mkldnn:False +--cpu_threads:1|6 +--rec_batch_num:1 +--use_tensorrt:False|True +--precision:fp16|fp32 +--det_model_dir: +--image_dir:./inference/ch_det_data_50/all-sum-510/ +null:null +--benchmark:True +null:null diff --git a/test_tipc/configs/ppocr_det_mobile/model_linux_gpu_normal_normal_infer_python_mac.txt b/test_tipc/configs/ppocr_det_mobile/model_linux_gpu_normal_normal_infer_python_mac.txt deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/test_tipc/configs/ppocr_det_mobile/train_infer_python.txt b/test_tipc/configs/ppocr_det_mobile/train_infer_python.txt index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..189097327f49f58548e31cc4223d6ca1299a2e3a 100644 --- a/test_tipc/configs/ppocr_det_mobile/train_infer_python.txt +++ b/test_tipc/configs/ppocr_det_mobile/train_infer_python.txt @@ -0,0 +1,51 @@ +===========================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_lite_infer=1|whole_train_whole_infer=300 +Global.save_model_dir:./output/ +Train.loader.batch_size_per_card:lite_train_lite_infer=2|whole_train_whole_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 test_tipc/configs/det_mv3_db.yml -o Global.pretrained_model=./pretrain_models/MobileNetV3_large_x0_5_pretrained +pact_train:deploy/slim/quantization/quant.py -c test_tipc/configs/det_mv3_db.yml -o +fpgm_train:deploy/slim/prune/sensitivity_anal.py -c test_tipc/configs/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:null +null:null +## +===========================infer_params=========================== +Global.save_inference_dir:./output/ +Global.pretrained_model: +norm_export:tools/export_model.py -c test_tipc/configs/det_mv3_db.yml -o +quant_export:deploy/slim/quantization/export_model.py -c test_tipc/configs/det_mv3_db.yml -o +fpgm_export:deploy/slim/prune/export_prune_model.py -c test_tipc/configs/det_mv3_db.yml -o +distill_export:null +export1:null +export2:null +inference_dir:null +train_model:./inference/ch_ppocr_mobile_v2.0_det_train/best_accuracy +infer_export:tools/export_model.py -c configs/det/ch_ppocr_v2.0/ch_det_mv3_db_v2.0.yml -o +infer_quant:False +inference:tools/infer/predict_det.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/ +null:null +--benchmark:True +null:null \ No newline at end of file diff --git a/test_tipc/configs/mac_ppocr_det_mobile_params.txt b/test_tipc/configs/ppocr_det_mobile/train_linux_cpu_normal_normal_infer_python_mac.txt similarity index 100% rename from test_tipc/configs/mac_ppocr_det_mobile_params.txt rename to test_tipc/configs/ppocr_det_mobile/train_linux_cpu_normal_normal_infer_python_mac.txt diff --git a/test_tipc/configs/win_ppocr_det_mobile_params.txt b/test_tipc/configs/ppocr_det_mobile/train_linux_gpu_normal_normal_infer_python_windows.txt similarity index 100% rename from test_tipc/configs/win_ppocr_det_mobile_params.txt rename to test_tipc/configs/ppocr_det_mobile/train_linux_gpu_normal_normal_infer_python_windows.txt diff --git a/test_tipc/configs/ppocrv2_det_mobile_params.txt b/test_tipc/configs/ppocrv2_det_mobile/train_infer_python.txt similarity index 100% rename from test_tipc/configs/ppocrv2_det_mobile_params.txt rename to test_tipc/configs/ppocrv2_det_mobile/train_infer_python.txt diff --git a/test_tipc/docs/install.md b/test_tipc/docs/install.md index f17c264f3987c8cc2a756e045ebacb8fba5c277a..c1cd163e061b146fe0f25f9e3ef7f409992e2f91 100644 --- a/test_tipc/docs/install.md +++ b/test_tipc/docs/install.md @@ -1,6 +1,6 @@ ## 1. 环境准备 -本教程适用于PTDN目录下基础功能测试的运行环境搭建。 +本教程适用于test_tipc目录下基础功能测试的运行环境搭建。 推荐环境: - CUDA 10.1/10.2 diff --git a/test_tipc/test_inference_jeston.sh b/test_tipc/test_inference_jeston.sh new file mode 100644 index 0000000000000000000000000000000000000000..2fd76e1e9e7e8c7b52d0b6838cd15840a59fe5c4 --- /dev/null +++ b/test_tipc/test_inference_jeston.sh @@ -0,0 +1,87 @@ +#!/bin/bash +source test_tipc/common_func.sh +source test_tipc/test_train_inference_python.sh + +FILENAME=$1 +# MODE be one of ['whole_infer'] +MODE=$2 + +dataline=$(awk 'NR==1, NR==17{print}' $FILENAME) + +# parser params +IFS=$'\n' +lines=(${dataline}) + +model_name=$(func_parser_value "${lines[1]}") +python=$(func_parser_value "${lines[2]}") + +infer_model_dir_list=$(func_parser_value "${lines[3]}") +infer_export_list=$(func_parser_value "${lines[4]}") +infer_is_quant=$(func_parser_value "${lines[5]}") +# parser inference +inference_py=$(func_parser_value "${lines[6]}") +use_gpu_key=$(func_parser_key "${lines[7]}") +use_gpu_list=$(func_parser_value "${lines[7]}") +use_mkldnn_key=$(func_parser_key "${lines[8]}") +use_mkldnn_list=$(func_parser_value "${lines[8]}") +cpu_threads_key=$(func_parser_key "${lines[9]}") +cpu_threads_list=$(func_parser_value "${lines[9]}") +batch_size_key=$(func_parser_key "${lines[10]}") +batch_size_list=$(func_parser_value "${lines[10]}") +use_trt_key=$(func_parser_key "${lines[11]}") +use_trt_list=$(func_parser_value "${lines[11]}") +precision_key=$(func_parser_key "${lines[12]}") +precision_list=$(func_parser_value "${lines[12]}") +infer_model_key=$(func_parser_key "${lines[13]}") +image_dir_key=$(func_parser_key "${lines[14]}") +infer_img_dir=$(func_parser_value "${lines[14]}") +save_log_key=$(func_parser_key "${lines[15]}") +benchmark_key=$(func_parser_key "${lines[16]}") +benchmark_value=$(func_parser_value "${lines[16]}") +infer_key1=$(func_parser_key "${lines[17]}") +infer_value1=$(func_parser_value "${lines[17]}") + + +LOG_PATH="./test_tipc/output" +mkdir -p ${LOG_PATH} +status_log="${LOG_PATH}/results_python.log" + + +if [ ${MODE} = "whole_infer" ]; then + GPUID=$3 + if [ ${#GPUID} -le 0 ];then + env=" " + else + env="export CUDA_VISIBLE_DEVICES=${GPUID}" + fi + # set CUDA_VISIBLE_DEVICES + eval $env + export Count=0 + IFS="|" + infer_run_exports=(${infer_export_list}) + infer_quant_flag=(${infer_is_quant}) + for infer_model in ${infer_model_dir_list[*]}; do + # run export + if [ ${infer_run_exports[Count]} != "null" ];then + save_infer_dir=$(dirname $infer_model) + set_export_weight=$(func_set_params "${export_weight}" "${infer_model}") + set_save_infer_key=$(func_set_params "${save_infer_key}" "${save_infer_dir}") + export_cmd="${python} ${infer_run_exports[Count]} ${set_export_weight} ${set_save_infer_key}" + echo ${infer_run_exports[Count]} + echo $export_cmd + eval $export_cmd + status_export=$? + status_check $status_export "${export_cmd}" "${status_log}" + else + save_infer_dir=${infer_model} + fi + #run inference + is_quant=${infer_quant_flag[Count]} + if [ ${MODE} = "klquant_infer" ]; then + is_quant="True" + fi + func_inference "${python}" "${inference_py}" "${save_infer_dir}" "${LOG_PATH}" "${infer_img_dir}" ${is_quant} + Count=$(($Count + 1)) + done +fi +