diff --git a/test_tipc/benchmark_train.sh b/test_tipc/benchmark_train.sh index 3e5cb9efcac1f3907a476306806ff6836444d096..dd7471d033f2877d8f033c2d7cb2300c31798f43 100644 --- a/test_tipc/benchmark_train.sh +++ b/test_tipc/benchmark_train.sh @@ -23,6 +23,18 @@ function func_parser_params(){ echo ${tmp} } +function set_dynamic_epoch(){ + string=$1 + num=$2 + _str=${string:1:6} + IFS="C" + arr=(${_str}) + M=${arr[0]} + P=${arr[1]} + ep=`expr $num \* $P` + echo $ep +} + function func_sed_params(){ filename=$1 line=$2 @@ -83,9 +95,8 @@ line_num=`expr $line_num + 1` fp_items=$(func_parser_value "${lines[line_num]}") line_num=`expr $line_num + 1` epoch=$(func_parser_value "${lines[line_num]}") -eval "sed -i '10i\ repeat: ${epoch}' configs/datasets/coco_detection.yml" -eval "sed -i '10i\ repeat: ${epoch}' configs/datasets/coco_instance.yml" -eval "sed -i '10i\ repeat: ${epoch}' configs/datasets/mot.yml" +line_num=`expr $line_num + 1` +repeat=$(func_parser_value "${lines[line_num]}") line_num=`expr $line_num + 1` profile_option_key=$(func_parser_key "${lines[line_num]}") @@ -130,7 +141,8 @@ if [ ! -n "$PARAMS" ] ;then IFS="|" batch_size_list=(${batch_size}) fp_items_list=(${fp_items}) - device_num_list=(N1C4) + device_num="N1C4" + device_num_list=($device_num) run_mode="DP" else # parser params from input: modeltype_bs${bs_item}_${fp_item}_${run_mode}_${device_num} @@ -153,6 +165,16 @@ else device_num_list=($device_num) fi +if [[ ${model_name} =~ "higherhrnet" ]] || [[ ${model_name} =~ "hrnet" ]] || [[ ${model_name} =~ "tinypose" ]];then + epoch=$(set_dynamic_epoch $device_num $epoch) +else + epoch=1 + repeat=$(set_dynamic_epoch $device_num $repeat) + eval "sed -i '10c\ repeat: ${repeat}' configs/datasets/coco_detection.yml" + eval "sed -i '10c\ repeat: ${repeat}' configs/datasets/coco_instance.yml" + eval "sed -i '10c\ repeat: ${repeat}' configs/datasets/mot.yml" +fi + IFS="|" for batch_size in ${batch_size_list[*]}; do for precision in ${fp_items_list[*]}; do @@ -160,7 +182,7 @@ for batch_size in ${batch_size_list[*]}; do # sed batchsize and precision func_sed_params "$FILENAME" "${line_precision}" "$precision" func_sed_params "$FILENAME" "${line_batchsize}" "$MODE=$batch_size" - func_sed_params "$FILENAME" "${line_epoch}" "$MODE=1" + func_sed_params "$FILENAME" "${line_epoch}" "$MODE=$epoch" gpu_id=$(set_gpu_id $device_num) if [ ${#gpu_id} -le 1 ];then diff --git a/test_tipc/configs/deformable_detr/deformable_detr_r50_1x_coco_train_infer_python.txt b/test_tipc/configs/deformable_detr/deformable_detr_r50_1x_coco_train_infer_python.txt index 3bdfd193aae3fd7c861292b2261e95303a2aae87..b6a238460807a60cc28b64e6b70b8556c7ce0f91 100644 --- a/test_tipc/configs/deformable_detr/deformable_detr_r50_1x_coco_train_infer_python.txt +++ b/test_tipc/configs/deformable_detr/deformable_detr_r50_1x_coco_train_infer_python.txt @@ -53,5 +53,6 @@ inference:./deploy/python/infer.py batch_size:2 fp_items:fp32|fp16 epoch:1 +repeat:1 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile flags:null \ No newline at end of file diff --git a/test_tipc/configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco_train_infer_python.txt b/test_tipc/configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco_train_infer_python.txt index 360498e7489b1e565329494d8777c8e131f3055f..7bfad1c689fa016cec7b54c13bb3109a7fe07db4 100644 --- a/test_tipc/configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco_train_infer_python.txt +++ b/test_tipc/configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco_train_infer_python.txt @@ -53,6 +53,7 @@ inference:./deploy/python/infer.py batch_size:2|8 fp_items:fp32|fp16 epoch:1 +repeat:1 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile flags:null ===========================infer_benchmark_params=========================== diff --git a/test_tipc/configs/fcos/fcos_r50_fpn_1x_coco_train_infer_python.txt b/test_tipc/configs/fcos/fcos_r50_fpn_1x_coco_train_infer_python.txt index 4c4bb5cfe092fd5108362bedc9512e55c9609b3c..136d1c30e973751e4e64041367efa945c53cc0e7 100644 --- a/test_tipc/configs/fcos/fcos_r50_fpn_1x_coco_train_infer_python.txt +++ b/test_tipc/configs/fcos/fcos_r50_fpn_1x_coco_train_infer_python.txt @@ -53,6 +53,7 @@ inference:./deploy/python/infer.py batch_size:2|8 fp_items:fp32|fp16 epoch:1 +repeat:1 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile flags:null ===========================infer_benchmark_params=========================== diff --git a/test_tipc/configs/gfl/gfl_r50_fpn_1x_coco_train_infer_python.txt b/test_tipc/configs/gfl/gfl_r50_fpn_1x_coco_train_infer_python.txt index 5f4a0effbef3c88bcc45feb45ec2d3513acaa4ba..23722615b3183ca3634685b8d2aaafbd967b4edd 100644 --- a/test_tipc/configs/gfl/gfl_r50_fpn_1x_coco_train_infer_python.txt +++ b/test_tipc/configs/gfl/gfl_r50_fpn_1x_coco_train_infer_python.txt @@ -53,5 +53,6 @@ inference:./deploy/python/infer.py batch_size:2|8 fp_items:fp32|fp16 epoch:1 +repeat:1 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile flags:null \ No newline at end of file diff --git a/test_tipc/configs/keypoint/higherhrnet_hrnet_w32_512_train_infer_python.txt b/test_tipc/configs/keypoint/higherhrnet_hrnet_w32_512_train_infer_python.txt index 4c5161046a539076ee1a6aa293557831c7d35b68..b827e92ebd10542a48fde37b13bbc51caa857cf5 100644 --- a/test_tipc/configs/keypoint/higherhrnet_hrnet_w32_512_train_infer_python.txt +++ b/test_tipc/configs/keypoint/higherhrnet_hrnet_w32_512_train_infer_python.txt @@ -53,6 +53,7 @@ inference:./deploy/python/keypoint_infer.py batch_size:20|24 fp_items:fp32|fp16 epoch:20 +repeat:1 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile flags:null ===========================infer_benchmark_params=========================== diff --git a/test_tipc/configs/keypoint/hrnet_w32_256x192_train_infer_python.txt b/test_tipc/configs/keypoint/hrnet_w32_256x192_train_infer_python.txt index 895a42f7872a0882be661a04a062a57fdec819ad..036c542a9822ab98a2aedd1d6362906be5fa1c52 100644 --- a/test_tipc/configs/keypoint/hrnet_w32_256x192_train_infer_python.txt +++ b/test_tipc/configs/keypoint/hrnet_w32_256x192_train_infer_python.txt @@ -53,6 +53,7 @@ null:null batch_size:64|160 fp_items:fp32|fp16 epoch:40 +repeat:1 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile flags:null ===========================infer_benchmark_params=========================== diff --git a/test_tipc/configs/keypoint/tinypose_128x96_train_infer_python.txt b/test_tipc/configs/keypoint/tinypose_128x96_train_infer_python.txt index 2ab30ea781bf77bac8be6beb0f384bc9da9d5171..738a34885acfbc82320ea8251d226cebb2dabb54 100644 --- a/test_tipc/configs/keypoint/tinypose_128x96_train_infer_python.txt +++ b/test_tipc/configs/keypoint/tinypose_128x96_train_infer_python.txt @@ -54,6 +54,7 @@ random_infer_input:[{float32,[3,128,96]}] ===========================train_benchmark_params========================== batch_size:512 fp_items:fp32|fp16 -epoch:1 +epoch:25 +repeat:1 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile flags:null \ No newline at end of file diff --git a/test_tipc/configs/mask_rcnn/mask_rcnn_r50_1x_coco_train_infer_python.txt b/test_tipc/configs/mask_rcnn/mask_rcnn_r50_1x_coco_train_infer_python.txt index d82e0db2acd85674d251e3107f63ab16d982cdc8..0437aa92909d5411206e260d3fca04867b7386c0 100644 --- a/test_tipc/configs/mask_rcnn/mask_rcnn_r50_1x_coco_train_infer_python.txt +++ b/test_tipc/configs/mask_rcnn/mask_rcnn_r50_1x_coco_train_infer_python.txt @@ -49,11 +49,5 @@ inference:./deploy/python/infer.py --save_log_path:null --run_benchmark:False --trt_max_shape:1600 -===========================train_benchmark_params========================== -batch_size:2|4 -fp_items:fp32|fp16 -epoch:1 ---profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile -flags:null ===========================infer_benchmark_params=========================== numpy_infer_input:3x800x1344.npy \ No newline at end of file diff --git a/test_tipc/configs/mask_rcnn/mask_rcnn_r50_fpn_1x_coco_train_infer_python.txt b/test_tipc/configs/mask_rcnn/mask_rcnn_r50_fpn_1x_coco_train_infer_python.txt index 6071bdec37663183d083f6cfc00a302068c451d5..f03b573c0fb9d5fb6d420216d18a422053764714 100644 --- a/test_tipc/configs/mask_rcnn/mask_rcnn_r50_fpn_1x_coco_train_infer_python.txt +++ b/test_tipc/configs/mask_rcnn/mask_rcnn_r50_fpn_1x_coco_train_infer_python.txt @@ -53,6 +53,7 @@ inference:./deploy/python/infer.py batch_size:2|4 fp_items:fp32|fp16 epoch:1 +repeat:1 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile flags:null ===========================infer_benchmark_params=========================== diff --git a/test_tipc/configs/mot/fairmot_dla34_30e_1088x608_train_infer_python.txt b/test_tipc/configs/mot/fairmot_dla34_30e_1088x608_train_infer_python.txt index 650878ebab3f32ae374e4ead4a11a65991a45f23..0cf5b61b8777692cda63fa5c8e1016da7c126a47 100644 --- a/test_tipc/configs/mot/fairmot_dla34_30e_1088x608_train_infer_python.txt +++ b/test_tipc/configs/mot/fairmot_dla34_30e_1088x608_train_infer_python.txt @@ -52,7 +52,8 @@ inference:./deploy/pptracking/python/mot_jde_infer.py ===========================train_benchmark_params========================== batch_size:6|22 fp_items:fp32|fp16 -epoch:2 +epoch:1 +repeat:2 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile flags:null ===========================infer_benchmark_params=========================== diff --git a/test_tipc/configs/mot/jde_darknet53_30e_1088x608_train_infer_python.txt b/test_tipc/configs/mot/jde_darknet53_30e_1088x608_train_infer_python.txt index f9e024b0fe98c386ff01882740c19772abc404ea..e5760fbea07148a62345e297b1dd1d651f64ee73 100644 --- a/test_tipc/configs/mot/jde_darknet53_30e_1088x608_train_infer_python.txt +++ b/test_tipc/configs/mot/jde_darknet53_30e_1088x608_train_infer_python.txt @@ -53,6 +53,7 @@ inference:./deploy/pptracking/python/mot_jde_infer.py batch_size:4|14 fp_items:fp32|fp16 epoch:1 +repeat:1 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile flags:null ===========================infer_benchmark_params=========================== diff --git a/test_tipc/configs/picodet/picodet_lcnet_1_5x_416_coco_train_infer_python.txt b/test_tipc/configs/picodet/picodet_lcnet_1_5x_416_coco_train_infer_python.txt index d59ca2a39f993377d24f3e47e899c5cadbfe26d6..b5b0676d423fe34dcaefdac65fd3d6dc47ace65f 100644 --- a/test_tipc/configs/picodet/picodet_lcnet_1_5x_416_coco_train_infer_python.txt +++ b/test_tipc/configs/picodet/picodet_lcnet_1_5x_416_coco_train_infer_python.txt @@ -55,5 +55,6 @@ numpy_infer_input:3x416x416_2.npy batch_size:80 fp_items:fp32|fp16 epoch:1 +repeat:1 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile flags:null \ No newline at end of file diff --git a/test_tipc/configs/picodet/picodet_s_320_coco_lcnet_train_infer_python.txt b/test_tipc/configs/picodet/picodet_s_320_coco_lcnet_train_infer_python.txt index e603169a223928aff53dfa1b6024bfa8e3d6bd15..12874c6467b50cc38b20fa9a8c72f8fcf79304d3 100644 --- a/test_tipc/configs/picodet/picodet_s_320_coco_lcnet_train_infer_python.txt +++ b/test_tipc/configs/picodet/picodet_s_320_coco_lcnet_train_infer_python.txt @@ -55,5 +55,6 @@ numpy_infer_input:3x320x320_2.npy batch_size:128 fp_items:fp32|fp16 epoch:1 +repeat:1 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile flags:null \ No newline at end of file diff --git a/test_tipc/configs/picodet/picodet_s_320_coco_train_infer_python.txt b/test_tipc/configs/picodet/picodet_s_320_coco_train_infer_python.txt index 6745bcc527590b116556dff19fbadd3e6908013f..d04567e1e2daa52a0f9bb943aa81add2b2cedc3e 100644 --- a/test_tipc/configs/picodet/picodet_s_320_coco_train_infer_python.txt +++ b/test_tipc/configs/picodet/picodet_s_320_coco_train_infer_python.txt @@ -55,5 +55,6 @@ numpy_infer_input:3x320x320_2.npy batch_size:128 fp_items:fp32|fp16 epoch:1 +repeat:1 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile flags:null \ No newline at end of file diff --git a/test_tipc/configs/ppyolo/ppyolo_mbv3_large_coco_train_infer_python.txt b/test_tipc/configs/ppyolo/ppyolo_mbv3_large_coco_train_infer_python.txt index 801a2eaf2f1ee85922a7fba4c08180fc5cb47903..1735bfe5a9ae7ff3742881316d555a872480a326 100644 --- a/test_tipc/configs/ppyolo/ppyolo_mbv3_large_coco_train_infer_python.txt +++ b/test_tipc/configs/ppyolo/ppyolo_mbv3_large_coco_train_infer_python.txt @@ -55,5 +55,6 @@ numpy_infer_input:3x320x320.npy batch_size:24 fp_items:fp32|fp16 epoch:1 +repeat:1 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile flags:null \ No newline at end of file diff --git a/test_tipc/configs/ppyolo/ppyolo_r50vd_dcn_1x_coco_train_infer_python.txt b/test_tipc/configs/ppyolo/ppyolo_r50vd_dcn_1x_coco_train_infer_python.txt index 331f649a8979471e9da5ac2da0cf97800f56d5c3..8ab40462d50922f5a70f537c8d2f368365835b2d 100644 --- a/test_tipc/configs/ppyolo/ppyolo_r50vd_dcn_1x_coco_train_infer_python.txt +++ b/test_tipc/configs/ppyolo/ppyolo_r50vd_dcn_1x_coco_train_infer_python.txt @@ -55,5 +55,6 @@ numpy_infer_input:3x608x608.npy batch_size:24 fp_items:fp32|fp16 epoch:1 +repeat:1 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile flags:null \ No newline at end of file diff --git a/test_tipc/configs/ppyolo/ppyolo_tiny_650e_coco_train_infer_python.txt b/test_tipc/configs/ppyolo/ppyolo_tiny_650e_coco_train_infer_python.txt index 3201bcd4374c6d3bb7149136d9e91b864498d7e8..2fed9d1ba9bce30f1cd1c93d469378b1d67d187b 100644 --- a/test_tipc/configs/ppyolo/ppyolo_tiny_650e_coco_train_infer_python.txt +++ b/test_tipc/configs/ppyolo/ppyolo_tiny_650e_coco_train_infer_python.txt @@ -55,5 +55,6 @@ numpy_infer_input:3x320x320.npy batch_size:32 fp_items:fp32|fp16 epoch:1 +repeat:1 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile flags:null \ No newline at end of file diff --git a/test_tipc/configs/ppyolo/ppyolov2_r50vd_dcn_365e_coco_train_infer_python.txt b/test_tipc/configs/ppyolo/ppyolov2_r50vd_dcn_365e_coco_train_infer_python.txt index d767a3631aa173c0fb6226b7c7c9c2cf6dbff4c4..af0bb920fbd3eba02af43bae45514c3a924deff8 100644 --- a/test_tipc/configs/ppyolo/ppyolov2_r50vd_dcn_365e_coco_train_infer_python.txt +++ b/test_tipc/configs/ppyolo/ppyolov2_r50vd_dcn_365e_coco_train_infer_python.txt @@ -55,5 +55,6 @@ numpy_infer_input:3x640x640.npy batch_size:12 fp_items:fp32|fp16 epoch:1 +repeat:1 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile flags:null \ No newline at end of file diff --git a/test_tipc/configs/ppyoloe/ppyoloe_crn_s_300e_coco_train_infer_python.txt b/test_tipc/configs/ppyoloe/ppyoloe_crn_s_300e_coco_train_infer_python.txt index 459f6e02cedd9e8939d4346cde70f5ba8df760af..536d969b3700920dd46794c1cfc22fdbec05b524 100644 --- a/test_tipc/configs/ppyoloe/ppyoloe_crn_s_300e_coco_train_infer_python.txt +++ b/test_tipc/configs/ppyoloe/ppyoloe_crn_s_300e_coco_train_infer_python.txt @@ -55,5 +55,6 @@ numpy_infer_input:3x640x640.npy batch_size:32 fp_items:fp32|fp16 epoch:1 +repeat:1 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile flags:null \ No newline at end of file diff --git a/test_tipc/configs/solov2/solov2_r50_fpn_1x_coco_train_infer_python.txt b/test_tipc/configs/solov2/solov2_r50_fpn_1x_coco_train_infer_python.txt index 41282abc8130e16bb9b060ec88f02361f0d289b0..4cc4de1895b9c352fe82cafd2915563738f82228 100644 --- a/test_tipc/configs/solov2/solov2_r50_fpn_1x_coco_train_infer_python.txt +++ b/test_tipc/configs/solov2/solov2_r50_fpn_1x_coco_train_infer_python.txt @@ -53,6 +53,7 @@ inference:./deploy/python/infer.py batch_size:2|4 fp_items:fp32|fp16 epoch:1 +repeat:1 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile flags:null ===========================infer_benchmark_params=========================== diff --git a/test_tipc/configs/yolov3/yolov3_darknet53_270e_coco_train_infer_python.txt b/test_tipc/configs/yolov3/yolov3_darknet53_270e_coco_train_infer_python.txt index 472b2af56b0b45023e169beec3bd39fd48693bca..43e8e643c97eb16be323408ad0e595a190d65ec0 100644 --- a/test_tipc/configs/yolov3/yolov3_darknet53_270e_coco_train_infer_python.txt +++ b/test_tipc/configs/yolov3/yolov3_darknet53_270e_coco_train_infer_python.txt @@ -53,6 +53,7 @@ null:null batch_size:8 fp_items:fp32|fp16 epoch:1 +repeat:1 --profiler_options:batch_range=[10,20];state=GPU;tracer_option=Default;profile_path=model.profile flags:null ===========================infer_benchmark_params=========================== diff --git a/test_tipc/prepare.sh b/test_tipc/prepare.sh index c8259ae30d37053aff02fbe3b8829dbf3be038a2..252b59aa2a91ccc81aaa0d90ff977720db7115d9 100644 --- a/test_tipc/prepare.sh +++ b/test_tipc/prepare.sh @@ -83,7 +83,8 @@ elif [ ${MODE} = "cpp_infer" ];then fi cd ../../ elif [ ${MODE} = "benchmark_train" ];then - pip install -U pip Cython + pip install -U pip + pip install Cython pip install -r requirements.txt # prepare lite benchmark coco data wget -nc -P ./dataset/coco/ https://paddledet.bj.bcebos.com/data/coco_benchmark.tar --no-check-certificate diff --git a/test_tipc/test_train_inference_python.sh b/test_tipc/test_train_inference_python.sh index dba6b8de3f4642b44148df5c24ea9d52f9bac3d6..d92ef2c3ec6874f34f90a7259840811cdaf37f85 100644 --- a/test_tipc/test_train_inference_python.sh +++ b/test_tipc/test_train_inference_python.sh @@ -262,11 +262,6 @@ else continue fi - if [ ${autocast} = "amp" ] || [ ${autocast} = "fp16" ]; then - set_autocast="--amp" - else - set_autocast=" " - fi set_epoch=$(func_set_params "${epoch_key}" "${epoch_num}") set_pretrain=$(func_set_params "${pretrain_model_key}" "${pretrain_model_value}") set_batchsize=$(func_set_params "${train_batch_key}" "${train_batch_value}") @@ -274,6 +269,12 @@ else set_use_gpu=$(func_set_params "${train_use_gpu_key}" "${use_gpu}") set_train_params1=$(func_set_params "${train_param_key1}" "${train_param_value1}") save_log="${LOG_PATH}/${trainer}_gpus_${gpu}_autocast_${autocast}" + if [ ${autocast} = "amp" ] || [ ${autocast} = "fp16" ]; then + set_autocast="--amp" + set_train_params1="amp_level=O2" + else + set_autocast=" " + fi set_save_model=$(func_set_params "${save_model_key}" "${save_log}") nodes="1"