|
2 lat temu | |
---|---|---|
.. | ||
_base_ | 2 lat temu | |
visdrone | 2 lat temu | |
README.md | 2 lat temu | |
ppyoloe_crn_l_80e_sliced_visdrone_640_025.yml | 2 lat temu | |
ppyoloe_crn_l_80e_sliced_visdrone_640_025_slice_infer.yml | 2 lat temu | |
ppyoloe_p2_crn_l_80e_sliced_DOTA_500_025.yml | 2 lat temu | |
ppyoloe_p2_crn_l_80e_sliced_xview_400_025.yml | 2 lat temu | |
ppyoloe_plus_sod_crn_l_80e_coco.yml | 2 lat temu |
PaddleDetection团队提供了针对VisDrone-DET、DOTA水平框、Xview等小目标场景数据集的基于PP-YOLOE的检测模型,以及提供了一套使用SAHI(Slicing Aided Hyper Inference)工具切图和拼图的方案,用户可以下载模型进行使用。
AI Studio 官方教程案例请参考基于PP-YOLOE-SOD的无人机航拍图像检测案例全流程实操,欢迎一起动手实践学习。
注意:
注意:
模型 | COCOAPI mAPval 0.5:0.95 | COCOAPI mAPval 0.5 | COCOAPI mAPtest_dev 0.5:0.95 | COCOAPI mAPtest_dev 0.5 | MatlabAPI mAPtest_dev 0.5:0.95 | MatlabAPI mAPtest_dev 0.5 | 下载 | 配置文件 |
---|---|---|---|---|---|---|---|---|
PP-YOLOE-s | 23.5 | 39.9 | 19.4 | 33.6 | 23.68 | 40.66 | 下载链接 | 配置文件 |
PP-YOLOE-P2-Alpha-s | 24.4 | 41.6 | 20.1 | 34.7 | 24.55 | 42.19 | 下载链接 | 配置文件 |
PP-YOLOE+_SOD-s | 25.1 | 42.8 | 20.7 | 36.2 | 25.16 | 43.86 | 下载链接 | 配置文件 |
PP-YOLOE-l | 29.2 | 47.3 | 23.5 | 39.1 | 28.00 | 46.20 | 下载链接 | 配置文件 |
PP-YOLOE-P2-Alpha-l | 30.1 | 48.9 | 24.3 | 40.8 | 28.47 | 48.16 | 下载链接 | 配置文件 |
PP-YOLOE+_SOD-l | 31.9 | 52.1 | 25.6 | 43.5 | 30.25 | 51.18 | 下载链接 | 配置文件 |
PP-YOLOE-Alpha-largesize-l | 41.9 | 65.0 | 32.3 | 53.0 | 37.13 | 61.15 | 下载链接 | 配置文件 |
PP-YOLOE-P2-Alpha-largesize-l | 41.3 | 64.5 | 32.4 | 53.1 | 37.49 | 51.54 | 下载链接 | 配置文件 |
PP-YOLOE+_largesize-l | 43.3 | 66.7 | 33.5 | 54.7 | 38.24 | 62.76 | 下载链接 | 配置文件 |
PP-YOLOE+_SOD-largesize-l | 42.7 | 65.9 | 33.6 | 55.1 | 38.4 | 63.07 | 下载链接 | 配置文件 |
注意:
模型 | mAPval 0.5:0.95 | AP0.5 | AP0.75 | APsmall | APmedium | APlarge | ARsmall | ARmedium | ARlarge | 下载链接 | 配置文件 |
---|---|---|---|---|---|---|---|---|---|---|---|
PP-YOLOE+_l | 52.9 | 70.1 | 57.9 | 35.2 | 57.5 | 69.1 | 56.0 | 77.9 | 86.9 | 下载链接 | 配置文件 |
PP-YOLOE+_SOD-l | 53.0 | 70.4 | 57.7 | 37.1 | 57.5 | 69.0 | 56.5 | 77.5 | 86.7 | 下载链接 | 配置文件 |
注意:
模型 | 数据集 | SLICE_SIZE | OVERLAP_RATIO | 类别数 | mAPval 0.5:0.95 | APval 0.5 | 下载链接 | 配置文件 |
---|---|---|---|---|---|---|---|---|
PP-YOLOE-P2-l | DOTA | 500 | 0.25 | 15 | 53.9 | 78.6 | 下载链接 | 配置文件 |
PP-YOLOE-P2-l | Xview | 400 | 0.25 | 60 | 14.9 | 27.0 | 下载链接 | 配置文件 |
PP-YOLOE-l | VisDrone-DET | 640 | 0.25 | 10 | 38.5 | 60.2 | 下载链接 | 配置文件 |
注意:
pip install sahi
,参考installation。--slice_infer
,具体见下文模型库使用说明中的预测和部署。VisDrone-DET是一个无人机航拍场景的小目标数据集,整理后的COCO格式VisDrone-DET数据集下载链接,切图后的COCO格式数据集下载链接,检测其中的10类,包括 pedestrian(1), people(2), bicycle(3), car(4), van(5), truck(6), tricycle(7), awning-tricycle(8), bus(9), motor(10)
,原始数据集下载链接。
具体使用和下载请参考visdrone。
DOTA是一个大型的遥感影像公开数据集,这里使用DOTA-v1.0水平框数据集,切图后整理的COCO格式的DOTA水平框数据集下载链接,检测其中的15类,
包括 plane(0), baseball-diamond(1), bridge(2), ground-track-field(3), small-vehicle(4), large-vehicle(5), ship(6), tennis-court(7),basketball-court(8), storage-tank(9), soccer-ball-field(10), roundabout(11), harbor(12), swimming-pool(13), helicopter(14)
,
图片及原始数据集下载链接。
Xview是一个大型的航拍遥感检测数据集,目标极小极多,切图后整理的COCO格式数据集下载链接,检测其中的60类, 具体类别为:
Fixed-wing Aircraft(0),
Small Aircraft(1),
Cargo Plane(2),
Helicopter(3),
Passenger Vehicle(4),
Small Car(5),
Bus(6),
Pickup Truck(7),
Utility Truck(8),
Truck(9),
Cargo Truck(10),
Truck w/Box(11),
Truck Tractor(12),
Trailer(13),
Truck w/Flatbed(14),
Truck w/Liquid(15),
Crane Truck(16),
Railway Vehicle(17),
Passenger Car(18),
Cargo Car(19),
Flat Car(20),
Tank car(21),
Locomotive(22),
Maritime Vessel(23),
Motorboat(24),
Sailboat(25),
Tugboat(26),
Barge(27),
Fishing Vessel(28),
Ferry(29),
Yacht(30),
Container Ship(31),
Oil Tanker(32),
Engineering Vehicle(33),
Tower crane(34),
Container Crane(35),
Reach Stacker(36),
Straddle Carrier(37),
Mobile Crane(38),
Dump Truck(39),
Haul Truck(40),
Scraper/Tractor(41),
Front loader/Bulldozer(42),
Excavator(43),
Cement Mixer(44),
Ground Grader(45),
Hut/Tent(46),
Shed(47),
Building(48),
Aircraft Hangar(49),
Damaged Building(50),
Facility(51),
Construction Site(52),
Vehicle Lot(53),
Helipad(54),
Storage Tank(55),
Shipping container lot(56),
Shipping Container(57),
Pylon(58),
Tower(59)
,原始数据集下载链接。
用户自定义数据集准备请参考DET数据集标注工具和DET数据集准备教程去准备。
首先将你的数据集为COCO数据集格式,然后使用SAHI切图工具进行离线切图,对保存的子图按常规检测模型的训练流程走即可。 也可直接下载PaddleDetection团队提供的切图后的VisDrone-DET、DOTA水平框、Xview数据集。
执行以下指令使用混合精度训练PP-YOLOE
python -m paddle.distributed.launch --gpus 0,1,2,3,4,5,6,7 tools/train.py -c configs/smalldet/ppyoloe_crn_l_80e_sliced_visdrone_640_025.yml --amp --eval
注意:
--amp
以避免显存溢出。默认评估方式是子图评估,子图数据集的验证集设置为:
EvalDataset:
!COCODataSet
image_dir: val_images_640_025
anno_path: val_640_025.json
dataset_dir: dataset/visdrone_sliced
按常规检测模型的评估流程,评估提前切好并存下来的子图上的精度:
CUDA_VISIBLE_DEVICES=0 python tools/eval.py -c configs/smalldet/ppyoloe_crn_l_80e_sliced_visdrone_640_025.yml -o weights=https://paddledet.bj.bcebos.com/models/ppyoloe_crn_l_80e_sliced_visdrone_640_025.pdparams
修改验证集的标注文件路径为原图标注文件:
EvalDataset:
!COCODataSet
image_dir: VisDrone2019-DET-val
anno_path: val.json
dataset_dir: dataset/visdrone
直接评估原图上的精度:
CUDA_VISIBLE_DEVICES=0 python tools/eval.py -c configs/smalldet/ppyoloe_crn_l_80e_sliced_visdrone_640_025.yml -o weights=https://paddledet.bj.bcebos.com/models/ppyoloe_crn_l_80e_sliced_visdrone_640_025.pdparams
修改验证集的标注文件路径为原图标注文件:
# very slow, preferly eval with a determined weights(xx.pdparams)
# if you want to eval during training, change SlicedCOCODataSet to COCODataSet and delete sliced_size and overlap_ratio
EvalDataset:
!SlicedCOCODataSet
image_dir: VisDrone2019-DET-val
anno_path: val.json
dataset_dir: dataset/visdrone
sliced_size: [640, 640]
overlap_ratio: [0.25, 0.25]
会在评估过程中自动对原图进行切图最后再重组和融合结果来评估原图上的精度:
CUDA_VISIBLE_DEVICES=0 python tools/eval.py -c configs/smalldet/ppyoloe_crn_l_80e_sliced_visdrone_640_025_slice_infer.yml -o weights=https://paddledet.bj.bcebos.com/models/ppyoloe_crn_l_80e_sliced_visdrone_640_025.pdparams --slice_infer --combine_method=nms --match_threshold=0.6 --match_metric=ios
注意:
--slice_infer
表示切图预测并拼装重组结果,如果不使用则不写,注意需要确保EvalDataset的数据集类是选用的SlicedCOCODataSet而不是COCODataSet;--slice_size
表示切图的子图尺寸大小,设置--overlap_ratio
表示子图间重叠率,可以自行修改选择合适的子图尺度sliced_size和子图间重叠率overlap_ratio,如:
EvalDataset:
!SlicedCOCODataSet
image_dir: VisDrone2019-DET-val
anno_path: val.json
dataset_dir: dataset/visdrone
sliced_size: [480, 480]
overlap_ratio: [0.2, 0.2]
--combine_method
表示子图结果重组去重的方式,默认是nms
;--match_threshold
表示子图结果重组去重的阈值,默认是0.6;--match_metric
表示子图结果重组去重的度量标准,默认是ios
表示交小比(两个框交集面积除以更小框的面积),也可以选择交并比iou
(两个框交集面积除以并集面积),精度效果因数据集而而异,但选择ios
预测速度会更快一点;与评估流程基本相同,可以在提前切好并存下来的子图上预测,也可以对原图预测,如:
CUDA_VISIBLE_DEVICES=0 python tools/infer.py -c configs/smalldet/ppyoloe_crn_l_80e_sliced_visdrone_640_025.yml -o weights=https://paddledet.bj.bcebos.com/models/ppyoloe_crn_l_80e_sliced_visdrone_640_025.pdparams --infer_img=demo/0000315_01601_d_0000509.jpg --draw_threshold=0.25
也可以对原图进行自动切图并拼图重组来预测原图,如:
# 单张图
CUDA_VISIBLE_DEVICES=0 python tools/infer.py -c configs/smalldet/ppyoloe_crn_l_80e_sliced_visdrone_640_025.yml -o weights=https://paddledet.bj.bcebos.com/models/ppyoloe_crn_l_80e_sliced_visdrone_640_025.pdparams --infer_img=demo/0000315_01601_d_0000509.jpg --draw_threshold=0.25 --slice_infer --slice_size 640 640 --overlap_ratio 0.25 0.25 --combine_method=nms --match_threshold=0.6 --match_metric=ios --save_results=True
# 或图片文件夹
CUDA_VISIBLE_DEVICES=0 python tools/infer.py -c configs/smalldet/ppyoloe_crn_l_80e_sliced_visdrone_640_025.yml -o weights=https://paddledet.bj.bcebos.com/models/ppyoloe_crn_l_80e_sliced_visdrone_640_025.pdparams --infer_dir=demo/ --draw_threshold=0.25 --slice_infer --slice_size 640 640 --overlap_ratio 0.25 0.25 --combine_method=nms --match_threshold=0.6 --match_metric=ios
--slice_infer
表示切图预测并拼装重组结果,如果不使用则不写;--slice_size
表示切图的子图尺寸大小,设置--overlap_ratio
表示子图间重叠率;--combine_method
表示子图结果重组去重的方式,默认是nms
;--match_threshold
表示子图结果重组去重的阈值,默认是0.6;--match_metric
表示子图结果重组去重的度量标准,默认是ios
表示交小比(两个框交集面积除以更小框的面积),也可以选择交并比iou
(两个框交集面积除以并集面积),精度效果因数据集而而异,但选择ios
预测速度会更快一点;--save_results
表示保存图片结果为json文件,一般只单张图预测时使用;# export model
CUDA_VISIBLE_DEVICES=0 python tools/export_model.py -c configs/smalldet/ppyoloe_crn_l_80e_sliced_visdrone_640_025.yml -o weights=https://paddledet.bj.bcebos.com/models/ppyoloe_crn_l_80e_sliced_visdrone_640_025.pdparams
# deploy infer
CUDA_VISIBLE_DEVICES=0 python deploy/python/infer.py --model_dir=output_inference/ppyoloe_crn_l_80e_sliced_visdrone_640_025 --image_file=demo/0000315_01601_d_0000509.jpg --device=GPU --save_images --threshold=0.25
# deploy slice infer
# 单张图
CUDA_VISIBLE_DEVICES=0 python deploy/python/infer.py --model_dir=output_inference/ppyoloe_crn_l_80e_sliced_visdrone_640_025 --image_file=demo/0000315_01601_d_0000509.jpg --device=GPU --save_images --threshold=0.25 --slice_infer --slice_size 640 640 --overlap_ratio 0.25 0.25 --combine_method=nms --match_threshold=0.6 --match_metric=ios --save_results=True
# 或图片文件夹
CUDA_VISIBLE_DEVICES=0 python deploy/python/infer.py --model_dir=output_inference/ppyoloe_crn_l_80e_sliced_visdrone_640_025 --image_dir=demo/ --device=GPU --save_images --threshold=0.25 --slice_infer --slice_size 640 640 --overlap_ratio 0.25 0.25 --combine_method=nms --match_threshold=0.6 --match_metric=ios
--slice_infer
表示切图预测并拼装重组结果,如果不使用则不写;--slice_size
表示切图的子图尺寸大小,设置--overlap_ratio
表示子图间重叠率;--combine_method
表示子图结果重组去重的方式,默认是nms
;--match_threshold
表示子图结果重组去重的阈值,默认是0.6;--match_metric
表示子图结果重组去重的度量标准,默认是ios
表示交小比(两个框交集面积除以更小框的面积),也可以选择交并比iou
(两个框交集面积除以并集面积),精度效果因数据集而而异,但选择ios
预测速度会更快一点;--save_results
表示保存图片结果为json文件,一般只单张图预测时使用;首先统计所用数据集标注框的平均宽高占图片真实宽高的比例分布:
python tools/box_distribution.py --json_path ../../dataset/DOTA/annotations/train.json --out_img box_distribution.jpg
--json_path
:待统计数据集COCO 格式 annotation 的json文件路径--eval_size
:推理尺度(默认640)--small_sride
:模型最小步长(默认8)--out_img
:输出的统计分布图路径以DOTA数据集的train数据集为例,统计结果打印如下:
Suggested reg_range[1] is 13
Mean of all img_w is 2304.3981547196595
Mean of all img_h is 2180.9354151880766
Median of ratio_w is 0.03799439775910364
Median of ratio_h is 0.04074914637387802
all_img with box: 1409
all_ann: 98905
Distribution saved as box_distribution.jpg
注意:
Suggested reg_range[1]
为数据集在优化后DFL算法中推荐的reg_range
上限,即reg_max+1
。针对需要切图的数据集,使用SAHI库进行切分:
参考SAHI installation进行安装
pip install sahi
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
:原始数据集图片文件夹的路径--json_path
:原始数据集COCO格式的json标注文件的路径--output_dir
:切分后的子图及其json标注文件保存的路径--slice_size
:切分以后子图的边长尺度大小(默认切图后为正方形)--overlap_ratio
:切分时的子图之间的重叠率dota_sliced
文件夹下,分别命名为train_images_500_025
、train_500_025.json
。@article{akyon2022sahi,
title={Slicing Aided Hyper Inference and Fine-tuning for Small Object Detection},
author={Akyon, Fatih Cagatay and Altinuc, Sinan Onur and Temizel, Alptekin},
journal={2022 IEEE International Conference on Image Processing (ICIP)},
doi={10.1109/ICIP46576.2022.9897990},
pages={966-970},
year={2022}
}
@inproceedings{xia2018dota,
title={DOTA: A large-scale dataset for object detection in aerial images},
author={Xia, Gui-Song and Bai, Xiang and Ding, Jian and Zhu, Zhen and Belongie, Serge and Luo, Jiebo and Datcu, Mihai and Pelillo, Marcello and Zhang, Liangpei},
booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition},
pages={3974--3983},
year={2018}
}
@ARTICLE{9573394,
author={Zhu, Pengfei and Wen, Longyin and Du, Dawei and Bian, Xiao and Fan, Heng and Hu, Qinghua and Ling, Haibin},
journal={IEEE Transactions on Pattern Analysis and Machine Intelligence},
title={Detection and Tracking Meet Drones Challenge},
year={2021},
volume={},
number={},
pages={1-1},
doi={10.1109/TPAMI.2021.3119563}
}
模型 | 数据集 | SLICE_SIZE | OVERLAP_RATIO | 类别数 | mAPval 0.5:0.95 | APval 0.5 | 下载链接 | 配置文件 |
---|---|---|---|---|---|---|---|---|
PP-YOLOE-l (原图评估) | VisDrone-DET | 640 | 0.25 | 10 | 29.7 | 48.5 | 下载链接 | 配置文件 |
PP-YOLOE-l (拼图评估) | VisDrone-DET | 640 | 0.25 | 10 | 37.2 | 59.4 | 下载链接 | 配置文件 |