From 7b6bdf91e532cb7b57ed633971b5a917fad9714e Mon Sep 17 00:00:00 2001 From: Feng Ni Date: Wed, 31 Aug 2022 00:07:13 +0800 Subject: [PATCH] add fuse_normalize for ppyoloe smalldet (#6807) --- configs/smalldet/README.md | 10 +++++----- .../ppyoloe_crn_l_80e_sliced_visdrone_640_025.yml | 4 ++++ ...e_crn_l_80e_sliced_visdrone_640_025_slice_infer.yml | 4 ++++ .../ppyoloe_p2_crn_l_80e_sliced_DOTA_500_025.yml | 4 ++++ .../ppyoloe_p2_crn_l_80e_sliced_xview_400_025.yml | 4 ++++ configs/visdrone/ppyoloe_crn_l_80e_visdrone.yml | 4 ++++ .../ppyoloe_crn_l_alpha_largesize_80e_visdrone.yml | 1 + .../visdrone/ppyoloe_crn_l_p2_alpha_80e_visdrone.yml | 4 ++++ .../ppyoloe_crn_l_p2_alpha_largesize_80e_visdrone.yml | 1 + configs/visdrone/ppyoloe_crn_s_80e_visdrone.yml | 4 ++++ .../visdrone/ppyoloe_crn_s_p2_alpha_80e_visdrone.yml | 4 ++++ 11 files changed, 39 insertions(+), 5 deletions(-) diff --git a/configs/smalldet/README.md b/configs/smalldet/README.md index e8a16379c..f44e7d3fd 100644 --- a/configs/smalldet/README.md +++ b/configs/smalldet/README.md @@ -41,11 +41,11 @@ PaddleDetection团队提供了针对VisDrone-DET、DOTA水平框、Xview等小 **注意:** - 使用[SAHI](https://github.com/obss/sahi)切图工具需要首先安装:`pip install sahi`,参考[installation](https://github.com/obss/sahi/blob/main/README.md#installation)。 - **SLICE_SIZE**表示使用SAHI工具切图后子图的边长大小,**OVERLAP_RATIO**表示切图的子图之间的重叠率,DOTA水平框和Xview数据集均是切图后训练,AP指标为切图后的子图val上的指标。 -- VisDrone-DET数据集请参照[visdrone](../visdrone),可使用原图训练,也可使用切图后训练。 +- VisDrone-DET数据集请参照[visdrone](../visdrone),可使用原图训练,也可使用切图后训练,这上面表格中的指标均是使用VisDrone-DET的val子集做验证而未使用test_dev子集。 - PP-YOLOE模型训练过程中使用8 GPUs进行混合精度训练,如果**GPU卡数**或者**batch size**发生了改变,你需要按照公式 **lrnew = lrdefault * (batch_sizenew * GPU_numbernew) / (batch_sizedefault * GPU_numberdefault)** 调整学习率。 - 常用训练验证部署等步骤请参考[ppyoloe](../ppyoloe#getting-start)。 -- 自动切图和拼图的推理预测需添加设置`--slice_infer`,具体见下文使用说明。 -- Assembled表示自动切图和拼图。 +- 自动切图和拼图的推理预测需添加设置`--slice_infer`,具体见下文[模型库使用说明](#模型库使用说明)中的[预测](#预测)和[部署](#部署)。 +- Assembled表示自动切图和拼图,参照[2.3 子图拼图评估](#评估)。 ## 数据集准备 @@ -280,7 +280,7 @@ CUDA_VISIBLE_DEVICES=0 python deploy/python/infer.py --model_dir=output_inferenc 首先统计所用数据集标注框的平均宽高占图片真实宽高的比例分布: ```bash -python slice_tools/box_distribution.py --json_path ../../dataset/DOTA/annotations/train.json --out_img box_distribution.jpg +python tools/box_distribution.py --json_path ../../dataset/DOTA/annotations/train.json --out_img box_distribution.jpg ``` - `--json_path` :待统计数据集COCO 格式 annotation 的json文件路径 - `--out_img` :输出的统计分布图路径 @@ -313,7 +313,7 @@ pip install sahi #### 基于SAHI切图 ```bash -python slice_tools/slice_image.py --image_dir ../../dataset/DOTA/train/ --json_path ../../dataset/DOTA/annotations/train.json --output_dir ../../dataset/dota_sliced --slice_size 500 --overlap_ratio 0.25 +python tools/slice_image.py --image_dir ../../dataset/DOTA/train/ --json_path ../../dataset/DOTA/annotations/train.json --output_dir ../../dataset/dota_sliced --slice_size 500 --overlap_ratio 0.25 ``` - `--image_dir`:原始数据集图片文件夹的路径 diff --git a/configs/smalldet/ppyoloe_crn_l_80e_sliced_visdrone_640_025.yml b/configs/smalldet/ppyoloe_crn_l_80e_sliced_visdrone_640_025.yml index efb573a99..9df37919b 100644 --- a/configs/smalldet/ppyoloe_crn_l_80e_sliced_visdrone_640_025.yml +++ b/configs/smalldet/ppyoloe_crn_l_80e_sliced_visdrone_640_025.yml @@ -20,6 +20,10 @@ TrainReader: EvalReader: batch_size: 1 +TestReader: + batch_size: 1 + fuse_normalize: True + epoch: 80 LearningRate: diff --git a/configs/smalldet/ppyoloe_crn_l_80e_sliced_visdrone_640_025_slice_infer.yml b/configs/smalldet/ppyoloe_crn_l_80e_sliced_visdrone_640_025_slice_infer.yml index 6de6db4c0..5464c9550 100644 --- a/configs/smalldet/ppyoloe_crn_l_80e_sliced_visdrone_640_025_slice_infer.yml +++ b/configs/smalldet/ppyoloe_crn_l_80e_sliced_visdrone_640_025_slice_infer.yml @@ -20,6 +20,10 @@ TrainReader: EvalReader: batch_size: 1 # only support bs=1 when slice infer +TestReader: + batch_size: 1 + fuse_normalize: True + epoch: 80 LearningRate: diff --git a/configs/smalldet/ppyoloe_p2_crn_l_80e_sliced_DOTA_500_025.yml b/configs/smalldet/ppyoloe_p2_crn_l_80e_sliced_DOTA_500_025.yml index f7bdb5837..4e47f2c88 100644 --- a/configs/smalldet/ppyoloe_p2_crn_l_80e_sliced_DOTA_500_025.yml +++ b/configs/smalldet/ppyoloe_p2_crn_l_80e_sliced_DOTA_500_025.yml @@ -28,6 +28,10 @@ TrainReader: EvalReader: batch_size: 1 +TestReader: + batch_size: 1 + fuse_normalize: True + epoch: 80 LearningRate: diff --git a/configs/smalldet/ppyoloe_p2_crn_l_80e_sliced_xview_400_025.yml b/configs/smalldet/ppyoloe_p2_crn_l_80e_sliced_xview_400_025.yml index cbf20b2c2..e94d799b2 100644 --- a/configs/smalldet/ppyoloe_p2_crn_l_80e_sliced_xview_400_025.yml +++ b/configs/smalldet/ppyoloe_p2_crn_l_80e_sliced_xview_400_025.yml @@ -28,6 +28,10 @@ TrainReader: EvalReader: batch_size: 1 +TestReader: + batch_size: 1 + fuse_normalize: True + epoch: 80 LearningRate: diff --git a/configs/visdrone/ppyoloe_crn_l_80e_visdrone.yml b/configs/visdrone/ppyoloe_crn_l_80e_visdrone.yml index 93f8b40c8..5da9f177f 100644 --- a/configs/visdrone/ppyoloe_crn_l_80e_visdrone.yml +++ b/configs/visdrone/ppyoloe_crn_l_80e_visdrone.yml @@ -20,6 +20,10 @@ TrainReader: EvalReader: batch_size: 1 +TestReader: + batch_size: 1 + fuse_normalize: True + epoch: 80 LearningRate: diff --git a/configs/visdrone/ppyoloe_crn_l_alpha_largesize_80e_visdrone.yml b/configs/visdrone/ppyoloe_crn_l_alpha_largesize_80e_visdrone.yml index dcea2687a..c16f2116a 100644 --- a/configs/visdrone/ppyoloe_crn_l_alpha_largesize_80e_visdrone.yml +++ b/configs/visdrone/ppyoloe_crn_l_alpha_largesize_80e_visdrone.yml @@ -55,3 +55,4 @@ TestReader: - NormalizeImage: {mean: [0.485, 0.456, 0.406], std: [0.229, 0.224, 0.225], is_scale: True} - Permute: {} batch_size: 1 + fuse_normalize: True diff --git a/configs/visdrone/ppyoloe_crn_l_p2_alpha_80e_visdrone.yml b/configs/visdrone/ppyoloe_crn_l_p2_alpha_80e_visdrone.yml index cc0b5440c..f0093beb0 100644 --- a/configs/visdrone/ppyoloe_crn_l_p2_alpha_80e_visdrone.yml +++ b/configs/visdrone/ppyoloe_crn_l_p2_alpha_80e_visdrone.yml @@ -13,6 +13,10 @@ TrainReader: EvalReader: batch_size: 1 +TestReader: + batch_size: 1 + fuse_normalize: True + LearningRate: base_lr: 0.005 diff --git a/configs/visdrone/ppyoloe_crn_l_p2_alpha_largesize_80e_visdrone.yml b/configs/visdrone/ppyoloe_crn_l_p2_alpha_largesize_80e_visdrone.yml index 5aca08856..53b4c9f0d 100644 --- a/configs/visdrone/ppyoloe_crn_l_p2_alpha_largesize_80e_visdrone.yml +++ b/configs/visdrone/ppyoloe_crn_l_p2_alpha_largesize_80e_visdrone.yml @@ -62,3 +62,4 @@ TestReader: - NormalizeImage: {mean: [0.485, 0.456, 0.406], std: [0.229, 0.224, 0.225], is_scale: True} - Permute: {} batch_size: 1 + fuse_normalize: True diff --git a/configs/visdrone/ppyoloe_crn_s_80e_visdrone.yml b/configs/visdrone/ppyoloe_crn_s_80e_visdrone.yml index 555dab200..d3c386fd0 100644 --- a/configs/visdrone/ppyoloe_crn_s_80e_visdrone.yml +++ b/configs/visdrone/ppyoloe_crn_s_80e_visdrone.yml @@ -20,6 +20,10 @@ TrainReader: EvalReader: batch_size: 1 +TestReader: + batch_size: 1 + fuse_normalize: True + epoch: 80 LearningRate: diff --git a/configs/visdrone/ppyoloe_crn_s_p2_alpha_80e_visdrone.yml b/configs/visdrone/ppyoloe_crn_s_p2_alpha_80e_visdrone.yml index d82d25b98..70e34cd05 100644 --- a/configs/visdrone/ppyoloe_crn_s_p2_alpha_80e_visdrone.yml +++ b/configs/visdrone/ppyoloe_crn_s_p2_alpha_80e_visdrone.yml @@ -13,6 +13,10 @@ TrainReader: EvalReader: batch_size: 1 +TestReader: + batch_size: 1 + fuse_normalize: True + LearningRate: base_lr: 0.005 -- GitLab