From 2f0bfdb041f1c3af188151c223fa79bdd1fc3479 Mon Sep 17 00:00:00 2001 From: Feng Ni Date: Mon, 5 Sep 2022 17:41:47 +0800 Subject: [PATCH] add ppyoloeplus visdrone (#6818) --- configs/visdrone/README.md | 1 + ...oloe_plus_crn_l_largesize_80e_visdrone.yml | 58 +++++++++++++++++++ deploy/python/infer.py | 3 +- deploy/python/visualize.py | 4 +- ppdet/data/source/dataset.py | 6 +- 5 files changed, 67 insertions(+), 5 deletions(-) create mode 100644 configs/visdrone/ppyoloe_plus_crn_l_largesize_80e_visdrone.yml diff --git a/configs/visdrone/README.md b/configs/visdrone/README.md index 04de6870b..79901e8c1 100644 --- a/configs/visdrone/README.md +++ b/configs/visdrone/README.md @@ -17,6 +17,7 @@ PaddleDetection团队提供了针对VisDrone-DET小目标数航拍场景的基 |PP-YOLOE-P2-Alpha-l| 30.1 | 48.9 | 24.3 | 40.8 | 28.47 | 48.16 | [下载链接](https://paddledet.bj.bcebos.com/models/ppyoloe_crn_l_p2_alpha_80e_visdrone.pdparams) | [配置文件](./ppyoloe_crn_l_p2_alpha_80e_visdrone.yml) | |PP-YOLOE-Alpha-largesize-l| 41.9 | 65.0 | 32.3 | 53.0 | 37.13 | 61.15 | [下载链接](https://paddledet.bj.bcebos.com/models/ppyoloe_crn_l_alpha_largesize_80e_visdrone.pdparams) | [配置文件](./ppyoloe_crn_l_alpha_largesize_80e_visdrone.yml) | |PP-YOLOE-P2-Alpha-largesize-l| 41.3 | 64.5 | 32.4 | 53.1 | 37.49 | 51.54 | [下载链接](https://paddledet.bj.bcebos.com/models/ppyoloe_crn_l_p2_alpha_largesize_80e_visdrone.pdparams) | [配置文件](./ppyoloe_crn_l_p2_alpha_largesize_80e_visdrone.yml) | +|PP-YOLOE-plus-largesize-l | 43.3 | 66.7 | 33.5 | 54.7 | 38.24 | 62.76 | [下载链接](https://paddledet.bj.bcebos.com/models/ppyoloe_plus_crn_l_largesize_80e_visdrone.pdparams) | [配置文件](./ppyoloe_plus_crn_l_largesize_80e_visdrone.yml) | ## 原图评估和拼图评估对比: diff --git a/configs/visdrone/ppyoloe_plus_crn_l_largesize_80e_visdrone.yml b/configs/visdrone/ppyoloe_plus_crn_l_largesize_80e_visdrone.yml new file mode 100644 index 000000000..fddfe46a1 --- /dev/null +++ b/configs/visdrone/ppyoloe_plus_crn_l_largesize_80e_visdrone.yml @@ -0,0 +1,58 @@ +_BASE_: [ + 'ppyoloe_crn_l_80e_visdrone.yml', +] +log_iter: 100 +snapshot_epoch: 10 +weights: output/ppyoloe_plus_crn_l_largesize_80e_visdrone/model_final +pretrain_weights: https://paddledet.bj.bcebos.com/models/ppyoloe_plus_crn_l_80e_coco.pdparams + + +CSPResNet: + use_alpha: True + + +LearningRate: + base_lr: 0.0025 + + +worker_num: 2 +eval_height: &eval_height 1920 +eval_width: &eval_width 1920 +eval_size: &eval_size [*eval_height, *eval_width] + +TrainReader: + sample_transforms: + - Decode: {} + - RandomDistort: {} + - RandomExpand: {fill_value: [123.675, 116.28, 103.53]} + - RandomCrop: {} + - RandomFlip: {} + batch_transforms: + - BatchRandomResize: {target_size: [1024, 1088, 1152, 1216, 1280, 1344, 1408, 1472, 1536, 1600, 1664, 1728, 1792, 1856, 1920], random_size: True, random_interp: True, keep_ratio: False} + - NormalizeImage: {mean: [0., 0., 0.], std: [1., 1., 1.], norm_type: none} + - Permute: {} + - PadGT: {} + batch_size: 2 + shuffle: true + drop_last: true + use_shared_memory: true + collate_batch: true + +EvalReader: + sample_transforms: + - Decode: {} + - Resize: {target_size: *eval_size, keep_ratio: False, interp: 2} + - NormalizeImage: {mean: [0., 0., 0.], std: [1., 1., 1.], norm_type: none} + - Permute: {} + batch_size: 1 + +TestReader: + inputs_def: + image_shape: [3, *eval_height, *eval_width] + sample_transforms: + - Decode: {} + - Resize: {target_size: *eval_size, keep_ratio: False, interp: 2} + - NormalizeImage: {mean: [0., 0., 0.], std: [1., 1., 1.], norm_type: none} + - Permute: {} + batch_size: 1 + fuse_normalize: True diff --git a/deploy/python/infer.py b/deploy/python/infer.py index aefb0eb50..c27617589 100644 --- a/deploy/python/infer.py +++ b/deploy/python/infer.py @@ -235,7 +235,7 @@ class Detector(object): import sahi from sahi.slicing import slice_image except Exception as e: - logger.error( + print( 'sahi not found, plaese install sahi. ' 'for example: `pip install sahi`, see https://github.com/obss/sahi.' ) @@ -251,6 +251,7 @@ class Detector(object): overlap_width_ratio=overlap_ratio[1]) sub_img_num = len(slice_image_result) merged_bboxs = [] + print('sub_img_num', sub_img_num) batch_image_list = [ slice_image_result.images[_ind] for _ind in range(sub_img_num) diff --git a/deploy/python/visualize.py b/deploy/python/visualize.py index 2ab2f0323..4bc2e1783 100644 --- a/deploy/python/visualize.py +++ b/deploy/python/visualize.py @@ -237,8 +237,8 @@ def visualize_pose(imgfile, import matplotlib plt.switch_backend('agg') except Exception as e: - logger.error('Matplotlib not found, please install matplotlib.' - 'for example: `pip install matplotlib`.') + print('Matplotlib not found, please install matplotlib.' + 'for example: `pip install matplotlib`.') raise e skeletons, scores = results['keypoint'] skeletons = np.array(skeletons) diff --git a/ppdet/data/source/dataset.py b/ppdet/data/source/dataset.py index 4f54494a3..2eeaf6e70 100644 --- a/ppdet/data/source/dataset.py +++ b/ppdet/data/source/dataset.py @@ -13,8 +13,8 @@ # limitations under the License. import os +import copy import numpy as np - try: from collections.abc import Sequence except Exception: @@ -22,9 +22,11 @@ except Exception: from paddle.io import Dataset from ppdet.core.workspace import register, serializable from ppdet.utils.download import get_dataset_path -import copy from ppdet.data import source +from ppdet.utils.logger import setup_logger +logger = setup_logger(__name__) + @serializable class DetDataset(Dataset): -- GitLab