From 6bf1b44338c5b3ee835d382ed01a92e671bba2f9 Mon Sep 17 00:00:00 2001 From: Feng Ni Date: Fri, 15 Oct 2021 14:18:00 +0800 Subject: [PATCH] [benchmark] add jde/fairmot model training benchmark (#4307) --- benchmark/README.md | 4 ++-- benchmark/prepare.sh | 7 +++++++ benchmark/run_all.sh | 6 ++++-- benchmark/run_benchmark.sh | 12 +++++++----- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/benchmark/README.md b/benchmark/README.md index a9c99557b..59fb68106 100644 --- a/benchmark/README.md +++ b/benchmark/README.md @@ -33,7 +33,7 @@ bash benchmark/run_all.sh ### 运行指定模型 * Usage:bash run_benchmark.sh ${run_mode} ${batch_size} ${fp_item} ${max_epoch} ${model_name} -* model_name: faster_rcnn, fcos, deformable_detr, gfl +* model_name: faster_rcnn, fcos, deformable_detr, gfl, hrnet, higherhrnet, solov2, jde, fairmot ``` git clone https://github.com/PaddlePaddle/PaddleDetection.git cd PaddleDetection @@ -42,5 +42,5 @@ bash benchmark/prepare.sh # 单卡 CUDA_VISIBLE_DEVICES=0 bash benchmark/run_benchmark.sh sp 2 fp32 1 faster_rcnn # 多卡 -CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 bash run_benchmark.sh mp 2 fp32 1 faster_rcnn +CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 bash benchmark/run_benchmark.sh mp 2 fp32 1 faster_rcnn ``` diff --git a/benchmark/prepare.sh b/benchmark/prepare.sh index ec088cd1d..1b0db3e33 100644 --- a/benchmark/prepare.sh +++ b/benchmark/prepare.sh @@ -2,8 +2,15 @@ pip3.7 install -U pip Cython pip3.7 install -r requirements.txt + mv ./dataset/coco/download_coco.py . && rm -rf ./dataset/coco/* && mv ./download_coco.py ./dataset/coco/ # prepare lite train data wget -nc -P ./dataset/coco/ https://paddledet.bj.bcebos.com/data/coco_benchmark.tar cd ./dataset/coco/ && tar -xvf coco_benchmark.tar && mv -u coco_benchmark/* . rm -rf coco_benchmark/ + +rm -rf ./dataset/mot/* +# prepare mot mini train data +wget -nc -P ./dataset/mot/ https://paddledet.bj.bcebos.com/data/mot_benchmark.tar +cd ./dataset/mot/ && tar -xvf mot_benchmark.tar && mv -u mot_benchmark/* . +rm -rf mot_benchmark/ diff --git a/benchmark/run_all.sh b/benchmark/run_all.sh index eeacf5cb8..9e5aab1ea 100644 --- a/benchmark/run_all.sh +++ b/benchmark/run_all.sh @@ -8,7 +8,7 @@ # run prepare.sh bash benchmark/prepare.sh -model_name_list=(faster_rcnn fcos deformable_detr gfl) +model_name_list=(faster_rcnn fcos deformable_detr gfl hrnet higherhrnet solov2 jde fairmot) fp_item_list=(fp32) max_epoch=1 @@ -22,6 +22,8 @@ for model_name in ${model_name_list[@]}; do hrnet) bs_list=(64 160) ;; higherhrnet) bs_list=(20 24) ;; solov2) bs_list=(2 4) ;; + jde) bs_list=(4 14) ;; + fairmot) bs_list=(6 22) ;; *) echo "wrong model_name"; exit 1; esac for bs_item in ${bs_list[@]} @@ -29,7 +31,7 @@ for model_name in ${model_name_list[@]}; do echo "index is speed, 1gpus, begin, ${model_name}" run_mode=sp CUDA_VISIBLE_DEVICES=0 bash benchmark/run_benchmark.sh ${run_mode} ${bs_item} \ - ${fp_item} ${max_epoch} ${model_name} # (5min) + ${fp_item} ${max_epoch} ${model_name} sleep 60 echo "index is speed, 8gpus, run_mode is multi_process, begin, ${model_name}" diff --git a/benchmark/run_benchmark.sh b/benchmark/run_benchmark.sh index 14414d049..eeed52c0f 100644 --- a/benchmark/run_benchmark.sh +++ b/benchmark/run_benchmark.sh @@ -1,15 +1,15 @@ #!/usr/bin/env bash set -xe -# Usage:CUDA_VISIBLE_DEVICES=0 bash run_benchmark.sh ${run_mode} ${batch_size} ${fp_item} ${max_epoch} ${model_name} +# Usage:CUDA_VISIBLE_DEVICES=0 bash benchmark/run_benchmark.sh ${run_mode} ${batch_size} ${fp_item} ${max_epoch} ${model_name} python="python3.7" # Parameter description function _set_params(){ run_mode=${1:-"sp"} # sp|mp - batch_size=${2:-"2"} # + batch_size=${2:-"2"} fp_item=${3:-"fp32"} # fp32|fp16 - max_epoch=${4:-"1"} # + max_epoch=${4:-"1"} model_name=${5:-"model_name"} - run_log_path=${TRAIN_LOG_DIR:-$(pwd)} # TRAIN_LOG_DIR + run_log_path=${TRAIN_LOG_DIR:-$(pwd)} device=${CUDA_VISIBLE_DEVICES//,/ } arr=(${device}) @@ -29,6 +29,8 @@ function _train(){ hrnet) model_yml="configs/keypoint/hrnet/hrnet_w32_256x192.yml" ;; higherhrnet) model_yml="configs/keypoint/higherhrnet/higherhrnet_hrnet_w32_512.yml" ;; solov2) model_yml="configs/solov2/solov2_r50_fpn_1x_coco.yml" ;; + jde) model_yml="configs/mot/jde/jde_darknet53_30e_1088x608.yml" ;; + fairmot) model_yml="configs/mot/fairmot/fairmot_dla34_30e_1088x608.yml" ;; *) echo "Undefined model_name"; exit 1; esac @@ -50,7 +52,7 @@ function _train(){ log_parse_file="mylog/workerlog.0" ;; *) echo "choose run_mode(sp or mp)"; exit 1; esac -# + timeout 15m ${train_cmd} > ${log_file} 2>&1 if [ $? -ne 0 ];then echo -e "${train_cmd}, FAIL" -- GitLab