From 2fedefa3f2211fe04f7bf69d412124a09eacba3c Mon Sep 17 00:00:00 2001 From: zhoujun <572459439@qq.com> Date: Mon, 15 May 2023 16:09:28 +0800 Subject: [PATCH] add rt-detr, picodet-lcnet1x, picodet-lcnet2.5x to tipc (#8202) * add ppyoloe and picodet config * add config * update ppyoloe config * update picodet lcnet 2.5x * update picodet lcnet tipc * update picodet lcnet2.5x * make picodet stable * update batchsize * update ppyoloe tipc batchsize * update detr config * update dino config * update ppyoloe config --------- Co-authored-by: user3984 <2287245853@qq.com> --- .../picodet_lcnet_1_0x_416_coco.yml | 26 ++++++++ .../picodet_lcnet_2_5x_416_coco.yml | 26 ++++++++ ppdet/modeling/heads/simota_head.py | 8 +-- ..._r50_4scale_1x_coco_train_infer_python.txt | 2 +- ...lcnet_1_0x_416_coco_train_infer_python.txt | 60 ++++++++++++++++++ ...lcnet_2_5x_416_coco_train_infer_python.txt | 60 ++++++++++++++++++ .../picodet_s_320_coco_train_infer_python.txt | 2 +- ...plus_crn_l_80e_coco_train_infer_python.txt | 62 +++++++++++++++++++ ...r_hgnetv2_l_6x_coco_train_infer_python.txt | 58 +++++++++++++++++ 9 files changed, 298 insertions(+), 6 deletions(-) create mode 100644 configs/picodet/legacy_model/more_config/picodet_lcnet_1_0x_416_coco.yml create mode 100644 configs/picodet/legacy_model/more_config/picodet_lcnet_2_5x_416_coco.yml create mode 100644 test_tipc/configs/picodet/picodet_lcnet_1_0x_416_coco_train_infer_python.txt create mode 100644 test_tipc/configs/picodet/picodet_lcnet_2_5x_416_coco_train_infer_python.txt create mode 100644 test_tipc/configs/ppyoloe/ppyoloe+/ppyoloe_plus_crn_l_80e_coco_train_infer_python.txt create mode 100644 test_tipc/configs/rtdetr/rtdetr_hgnetv2_l_6x_coco_train_infer_python.txt diff --git a/configs/picodet/legacy_model/more_config/picodet_lcnet_1_0x_416_coco.yml b/configs/picodet/legacy_model/more_config/picodet_lcnet_1_0x_416_coco.yml new file mode 100644 index 000000000..bf4fb1cac --- /dev/null +++ b/configs/picodet/legacy_model/more_config/picodet_lcnet_1_0x_416_coco.yml @@ -0,0 +1,26 @@ +_BASE_: [ + '../../../datasets/coco_detection.yml', + '../../../runtime.yml', + '../_base_/picodet_esnet.yml', + '../_base_/optimizer_300e.yml', + '../_base_/picodet_416_reader.yml', +] + +pretrain_weights: https://paddledet.bj.bcebos.com/models/pretrained/LCNet_x1_0_pretrained.pdparams +weights: output/picodet_lcnet_1_5x_416_coco/model_final +find_unused_parameters: True +use_ema: true +cycle_epoch: 40 +snapshot_epoch: 10 + +PicoDet: + backbone: LCNet + neck: CSPPAN + head: PicoHead + +LCNet: + scale: 1.0 + feature_maps: [3, 4, 5] + +TrainReader: + batch_size: 90 \ No newline at end of file diff --git a/configs/picodet/legacy_model/more_config/picodet_lcnet_2_5x_416_coco.yml b/configs/picodet/legacy_model/more_config/picodet_lcnet_2_5x_416_coco.yml new file mode 100644 index 000000000..6708cba3e --- /dev/null +++ b/configs/picodet/legacy_model/more_config/picodet_lcnet_2_5x_416_coco.yml @@ -0,0 +1,26 @@ +_BASE_: [ + '../../../datasets/coco_detection.yml', + '../../../runtime.yml', + '../_base_/picodet_esnet.yml', + '../_base_/optimizer_300e.yml', + '../_base_/picodet_416_reader.yml', +] + +pretrain_weights: https://paddledet.bj.bcebos.com/models/pretrained/LCNet_x2_5_ssld_pretrained.pdparams +weights: output/picodet_lcnet_1_5x_416_coco/model_final +find_unused_parameters: True +use_ema: true +cycle_epoch: 40 +snapshot_epoch: 10 + +PicoDet: + backbone: LCNet + neck: CSPPAN + head: PicoHead + +LCNet: + scale: 2.5 + feature_maps: [3, 4, 5] + +TrainReader: + batch_size: 48 \ No newline at end of file diff --git a/ppdet/modeling/heads/simota_head.py b/ppdet/modeling/heads/simota_head.py index e74f01757..037c395c6 100644 --- a/ppdet/modeling/heads/simota_head.py +++ b/ppdet/modeling/heads/simota_head.py @@ -179,7 +179,7 @@ class OTAHead(GFLHead): num_level_anchors) num_total_pos = sum(pos_num_l) try: - paddle.distributed.all_reduce(num_total_pos) + paddle.distributed.all_reduce(paddle.to_tensor(num_total_pos)) num_total_pos = paddle.clip( num_total_pos / paddle.distributed.get_world_size(), min=1.) except: @@ -256,7 +256,7 @@ class OTAHead(GFLHead): avg_factor = sum(avg_factor) try: - paddle.distributed.all_reduce(avg_factor) + paddle.distributed.all_reduce(paddle.to_tensor(avg_factor)) avg_factor = paddle.clip( avg_factor / paddle.distributed.get_world_size(), min=1) except: @@ -397,7 +397,7 @@ class OTAVFLHead(OTAHead): num_level_anchors) num_total_pos = sum(pos_num_l) try: - paddle.distributed.all_reduce(num_total_pos) + paddle.distributed.all_reduce(paddle.to_tensor(num_total_pos)) num_total_pos = paddle.clip( num_total_pos / paddle.distributed.get_world_size(), min=1.) except: @@ -477,7 +477,7 @@ class OTAVFLHead(OTAHead): avg_factor = sum(avg_factor) try: - paddle.distributed.all_reduce(avg_factor) + paddle.distributed.all_reduce(paddle.to_tensor(avg_factor)) avg_factor = paddle.clip( avg_factor / paddle.distributed.get_world_size(), min=1) except: diff --git a/test_tipc/configs/dino/dino_r50_4scale_1x_coco_train_infer_python.txt b/test_tipc/configs/dino/dino_r50_4scale_1x_coco_train_infer_python.txt index ee694fdd7..475397867 100644 --- a/test_tipc/configs/dino/dino_r50_4scale_1x_coco_train_infer_python.txt +++ b/test_tipc/configs/dino/dino_r50_4scale_1x_coco_train_infer_python.txt @@ -13,7 +13,7 @@ train_infer_img_dir:./dataset/coco/test2017/ filename:null ## trainer:norm_train -norm_train:tools/train.py -c configs/dino/dino_r50_4scale_1x_coco.yml -o +norm_train:tools/train.py -c configs/dino/dino_r50_4scale_1x_coco.yml -o worker_num=32 pact_train:tools/train.py -c configs/dino/dino_r50_4scale_1x_coco.yml --slim_config _template_pact -o fpgm_train:tools/train.py -c configs/dino/dino_r50_4scale_1x_coco.yml --slim_config _template_fpgm -o distill_train:null diff --git a/test_tipc/configs/picodet/picodet_lcnet_1_0x_416_coco_train_infer_python.txt b/test_tipc/configs/picodet/picodet_lcnet_1_0x_416_coco_train_infer_python.txt new file mode 100644 index 000000000..f79e64152 --- /dev/null +++ b/test_tipc/configs/picodet/picodet_lcnet_1_0x_416_coco_train_infer_python.txt @@ -0,0 +1,60 @@ +===========================train_params=========================== +model_name:picodet_lcnet_1_0x_416_coco +python:python3.7 +gpu_list:0|0,1 +use_gpu:True +auto_cast:null +epoch:lite_train_lite_infer=1|lite_train_whole_infer=1|whole_train_whole_infer=300 +save_dir:null +TrainReader.batch_size:lite_train_lite_infer=2|lite_train_whole_infer=2|whole_train_whole_infer=80 +pretrain_weights:null +trained_model_name:model_final.pdparams +train_infer_img_dir:./dataset/coco/test2017/ +filename:null +## +trainer:norm_train +norm_train:tools/train.py -c configs/picodet/legacy_model/more_config/picodet_lcnet_1_0x_416_coco.yml -o +pact_train:tools/train.py -c configs/picodet/legacy_model/more_config/picodet_lcnet_1_0x_416_coco.yml --slim_config _template_pact -o +fpgm_train:tools/train.py -c configs/picodet/legacy_model/more_config/picodet_lcnet_1_0x_416_coco.yml --slim_config _template_fpgm -o +distill_train:null +null:null +null:null +## +===========================eval_params=========================== +eval:tools/eval.py -c configs/picodet/legacy_model/more_config/picodet_lcnet_1_0x_416_coco.yml -o +null:null +## +===========================infer_params=========================== +--output_dir:./output_inference +weights:null +norm_export:tools/export_model.py -c configs/picodet/legacy_model/more_config/picodet_lcnet_1_0x_416_coco.yml -o +pact_export:tools/export_model.py -c configs/picodet/legacy_model/more_config/picodet_lcnet_1_0x_416_coco.yml --slim_config _template_pact -o +fpgm_export:tools/export_model.py -c configs/picodet/legacy_model/more_config/picodet_lcnet_1_0x_416_coco.yml --slim_config _template_fpgm -o +distill_export:null +export1:null +export2:null +kl_quant_export:tools/post_quant.py -c configs/picodet/legacy_model/more_config/picodet_lcnet_1_0x_416_coco.yml --slim_config configs/slim/post_quant/yolov3_darknet53_ptq.yml -o +## +infer_mode:norm|kl_quant +infer_quant:False|True +inference:./deploy/python/infer.py +--device:gpu|cpu +--enable_mkldnn:False +--cpu_threads:4 +--batch_size:1 +--use_tensorrt:null +--run_mode:paddle +--model_dir: +--image_dir:./dataset/coco/test2017/ +--save_log_path:null +--run_benchmark:False +null:null +===========================train_benchmark_params========================== +batch_size:90 +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=========================== +numpy_infer_input:3x416x416_2.npy \ No newline at end of file diff --git a/test_tipc/configs/picodet/picodet_lcnet_2_5x_416_coco_train_infer_python.txt b/test_tipc/configs/picodet/picodet_lcnet_2_5x_416_coco_train_infer_python.txt new file mode 100644 index 000000000..eeb2cf25f --- /dev/null +++ b/test_tipc/configs/picodet/picodet_lcnet_2_5x_416_coco_train_infer_python.txt @@ -0,0 +1,60 @@ +===========================train_params=========================== +model_name:picodet_lcnet_2_5x_416_coco +python:python3.7 +gpu_list:0|0,1 +use_gpu:True +auto_cast:null +epoch:lite_train_lite_infer=1|lite_train_whole_infer=1|whole_train_whole_infer=300 +save_dir:null +TrainReader.batch_size:lite_train_lite_infer=2|lite_train_whole_infer=2|whole_train_whole_infer=80 +pretrain_weights:null +trained_model_name:model_final.pdparams +train_infer_img_dir:./dataset/coco/test2017/ +filename:null +## +trainer:norm_train +norm_train:tools/train.py -c configs/picodet/legacy_model/more_config/picodet_lcnet_2_5x_416_coco.yml -o +pact_train:tools/train.py -c configs/picodet/legacy_model/more_config/picodet_lcnet_2_5x_416_coco.yml --slim_config _template_pact -o +fpgm_train:tools/train.py -c configs/picodet/legacy_model/more_config/picodet_lcnet_2_5x_416_coco.yml --slim_config _template_fpgm -o +distill_train:null +null:null +null:null +## +===========================eval_params=========================== +eval:tools/eval.py -c configs/picodet/legacy_model/more_config/picodet_lcnet_2_5x_416_coco.yml -o +null:null +## +===========================infer_params=========================== +--output_dir:./output_inference +weights:null +norm_export:tools/export_model.py -c configs/picodet/legacy_model/more_config/picodet_lcnet_2_5x_416_coco.yml -o +pact_export:tools/export_model.py -c configs/picodet/legacy_model/more_config/picodet_lcnet_2_5x_416_coco.yml --slim_config _template_pact -o +fpgm_export:tools/export_model.py -c configs/picodet/legacy_model/more_config/picodet_lcnet_2_5x_416_coco.yml --slim_config _template_fpgm -o +distill_export:null +export1:null +export2:null +kl_quant_export:tools/post_quant.py -c configs/picodet/legacy_model/more_config/picodet_lcnet_2_5x_416_coco.yml --slim_config configs/slim/post_quant/yolov3_darknet53_ptq.yml -o +## +infer_mode:norm|kl_quant +infer_quant:False|True +inference:./deploy/python/infer.py +--device:gpu|cpu +--enable_mkldnn:False +--cpu_threads:4 +--batch_size:1 +--use_tensorrt:null +--run_mode:paddle +--model_dir: +--image_dir:./dataset/coco/test2017/ +--save_log_path:null +--run_benchmark:False +null:null +===========================train_benchmark_params========================== +batch_size:48 +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=========================== +numpy_infer_input:3x416x416_2.npy \ 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 0317fcf6f..01aa4644c 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 @@ -13,7 +13,7 @@ train_infer_img_dir:./dataset/coco/test2017/ filename:null ## trainer:norm_train -norm_train:tools/train.py -c configs/picodet/legacy_model/picodet_s_320_coco.yml -o +norm_train:tools/train.py -c configs/picodet/legacy_model/picodet_s_320_coco.yml -o worker_num=16 pact_train:tools/train.py -c configs/picodet/legacy_model/picodet_s_320_coco.yml --slim_config _template_pact -o fpgm_train:tools/train.py -c configs/picodet/legacy_model/picodet_s_320_coco.yml --slim_config _template_fpgm -o distill_train:null diff --git a/test_tipc/configs/ppyoloe/ppyoloe+/ppyoloe_plus_crn_l_80e_coco_train_infer_python.txt b/test_tipc/configs/ppyoloe/ppyoloe+/ppyoloe_plus_crn_l_80e_coco_train_infer_python.txt new file mode 100644 index 000000000..2f8c4558b --- /dev/null +++ b/test_tipc/configs/ppyoloe/ppyoloe+/ppyoloe_plus_crn_l_80e_coco_train_infer_python.txt @@ -0,0 +1,62 @@ +===========================train_params=========================== +model_name:ppyoloe_plus_crn_l_80e_coco +python:python3.7 +gpu_list:0|0,1 +use_gpu:True +auto_cast:null +epoch:lite_train_lite_infer=1|lite_train_whole_infer=1|whole_train_whole_infer=300 +save_dir:null +TrainReader.batch_size:lite_train_lite_infer=2|lite_train_whole_infer=2|whole_train_whole_infer=2 +pretrain_weights:https://paddledet.bj.bcebos.com/models/ppyoloe_plus_crn_l_80e_coco.pdparams +trained_model_name:model_final.pdparams +train_infer_img_dir:./dataset/coco/test2017/ +filename:null +## +trainer:norm_train +norm_train:tools/train.py -c configs/ppyoloe/ppyoloe_plus_crn_l_80e_coco.yml -o +pact_train:tools/train.py -c configs/ppyoloe/ppyoloe_plus_crn_l_80e_coco.yml --slim_config _template_pact -o +fpgm_train:tools/train.py -c configs/ppyoloe/ppyoloe_plus_crn_l_80e_coco.yml --slim_config _template_fpgm -o +distill_train:null +null:null +null:null +## +===========================eval_params=========================== +eval:tools/eval.py -c configs/ppyoloe/ppyoloe_plus_crn_l_80e_coco.yml -o +null:null +## +===========================infer_params=========================== +--output_dir:./output_inference +weights:https://paddledet.bj.bcebos.com/models/ppyoloe_plus_crn_l_80e_coco.pdparams +norm_export:tools/export_model.py -c configs/ppyoloe/ppyoloe_plus_crn_l_80e_coco.yml -o +pact_export:tools/export_model.py -c configs/ppyoloe/ppyoloe_plus_crn_l_80e_coco.yml --slim_config _template_pact -o +fpgm_export:tools/export_model.py -c configs/ppyoloe/ppyoloe_plus_crn_l_80e_coco.yml --slim_config _template_fpgm -o +distill_export:null +export1:null +export2:null +kl_quant_export:tools/post_quant.py -c configs/ppyoloe/ppyoloe_plus_crn_s_80e_coco.yml --slim_config configs/slim/post_quant/ppyoloe_crn_s_300e_coco_ptq.yml -o +## +infer_mode:norm|kl_quant +infer_quant:False|True +inference:./deploy/python/infer.py +--device:gpu|cpu +--enable_mkldnn:False +--cpu_threads:4 +--batch_size:1|2 +--use_tensorrt:null +--run_mode:paddle +--model_dir: +--image_dir:./dataset/coco/test2017/ +--save_log_path:null +--run_benchmark:False +--trt_max_shape:1600 +===========================train_benchmark_params========================== +batch_size:16 +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=========================== +numpy_infer_input:3x640x640_2.npy +===========================to_static_train_benchmark_params=========================== +to_static_train:--to_static diff --git a/test_tipc/configs/rtdetr/rtdetr_hgnetv2_l_6x_coco_train_infer_python.txt b/test_tipc/configs/rtdetr/rtdetr_hgnetv2_l_6x_coco_train_infer_python.txt new file mode 100644 index 000000000..db9dafd71 --- /dev/null +++ b/test_tipc/configs/rtdetr/rtdetr_hgnetv2_l_6x_coco_train_infer_python.txt @@ -0,0 +1,58 @@ +===========================train_params=========================== +model_name:rtdetr_hgnetv2_l_6x_coco +python:python3.7 +gpu_list:0|0,1 +use_gpu:True +auto_cast:null +epoch:lite_train_lite_infer=1|lite_train_whole_infer=1|whole_train_whole_infer=50 +save_dir:null +TrainReader.batch_size:lite_train_lite_infer=1|lite_train_whole_infer=4|whole_train_whole_infer=4 +pretrain_weights:https://bj.bcebos.com/v1/paddledet/models/rtdetr_hgnetv2_l_6x_coco.pdparams +trained_model_name:model_final.pdparams +train_infer_img_dir:./dataset/coco/test2017/ +filename:null +## +trainer:norm_train +norm_train:tools/train.py -c configs/rtdetr/rtdetr_hgnetv2_l_6x_coco.yml -o worker_num=16 +pact_train:null +fpgm_train:null +distill_train:null +null:null +null:null +## +===========================eval_params=========================== +eval:tools/eval.py -c configs/rtdetr/rtdetr_hgnetv2_l_6x_coco.yml -o +null:null +## +===========================infer_params=========================== +--output_dir:./output_inference +weights:https://bj.bcebos.com/v1/paddledet/models/rtdetr_hgnetv2_l_6x_coco.pdparams +norm_export:tools/export_model.py -c configs/rtdetr/rtdetr_hgnetv2_l_6x_coco.yml -o +pact_export:null +fpgm_export:null +distill_export:null +export1:null +export2:null +kl_quant_export:null +## +infer_mode:norm +infer_quant:False +inference:./deploy/python/infer.py +--device:gpu|cpu +--enable_mkldnn:False +--cpu_threads:4 +--batch_size:1|2 +--use_tensorrt:null +--run_mode:paddle +--model_dir: +--image_dir:./dataset/coco/test2017/ +--save_log_path:null +--run_benchmark:False +--trt_max_shape:1600 +===========================train_benchmark_params========================== +batch_size:16 +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 -- GitLab