简体中文 | English
PaddleYOLO is a YOLO series toolbox based on PaddleDetection, only relevant codes of YOLO series models are included. It supports YOLOv3
,PP-YOLO
,PP-YOLOv2
,PP-YOLOE
,PP-YOLOE+
,YOLOX
,YOLOv5
,YOLOv6
,YOLOv7
,YOLOv8
,YOLOv5u
,YOLOv7u
,RTMDet
and so on, see COCO dataset ModelZoo in ModelZoo and configs.
Notes:
- The Licence of PaddleYOLO is GPL 3.0, the codes of YOLOv5,YOLOv6,YOLOv7 and YOLOv8 will not be merged into PaddleDetection. Except for these three YOLO models, other YOLO models are recommended to use in PaddleDetection, which will be the first to release the latest progress of PP-YOLO series detection model;
- To use PaddleYOLO, PaddlePaddle-2.3.2 or above is recommended,please refer to the official website to download the appropriate version. For Windows platforms, please install the paddle develop version;
- PaddleYOLO's Roadmap issue collects feature requests from user, welcome to put forward any opinions and suggestions.
Install
Clone repo and install requirements.txt in a Python>=3.7.0 environment, including PaddlePaddle>=2.3.2.
git clone https://github.com/PaddlePaddle/PaddleYOLO # clone
cd PaddleYOLO
pip install -r requirements.txt # install
Training/Evaluation/Inference
Write the following commands in a script file, such as run.sh
, and run as:sh run.sh
. You can also run the command line sentence by sentence.
model_name=ppyoloe # yolov7
job_name=ppyoloe_plus_crn_s_80e_coco # yolov7_tiny_300e_coco
config=configs/${model_name}/${job_name}.yml
log_dir=log_dir/${job_name}
# weights=https://bj.bcebos.com/v1/paddledet/models/${job_name}.pdparams
weights=output/${job_name}/model_final.pdparams
# 1.training(single GPU / multi GPU)
# CUDA_VISIBLE_DEVICES=0 python tools/train.py -c ${config} --eval --amp
python -m paddle.distributed.launch --log_dir=${log_dir} --gpus 0,1,2,3,4,5,6,7 tools/train.py -c ${config} --eval --amp
# 2.eval
CUDA_VISIBLE_DEVICES=0 python tools/eval.py -c ${config} -o weights=${weights} --classwise
# 3.infer
CUDA_VISIBLE_DEVICES=0 python tools/infer.py -c ${config} -o weights=${weights} --infer_img=demo/000000014439_640x640.jpg --draw_threshold=0.5
# CUDA_VISIBLE_DEVICES=0 python tools/infer.py -c ${config} -o weights=${weights} --infer_dir=demo/ --draw_threshold=0.5
Deployment/Speed
Write the following commands in a script file, such as run.sh
, and run as:sh run.sh
. You can also run the command line sentence by sentence.
model_name=ppyoloe # yolov7
job_name=ppyoloe_plus_crn_s_80e_coco # yolov7_tiny_300e_coco
config=configs/${model_name}/${job_name}.yml
log_dir=log_dir/${job_name}
# weights=https://bj.bcebos.com/v1/paddledet/models/${job_name}.pdparams
weights=output/${job_name}/model_final.pdparams
# 4.export
CUDA_VISIBLE_DEVICES=0 python tools/export_model.py -c ${config} -o weights=${weights} # trt=True
# CUDA_VISIBLE_DEVICES=0 python tools/export_model.py -c ${config} -o weights=${weights} exclude_post_process=True # trt=True
# CUDA_VISIBLE_DEVICES=0 python tools/export_model.py -c ${config} -o weights=${weights} exclude_nms=True # trt=True
# 5.deploy infer
CUDA_VISIBLE_DEVICES=0 python deploy/python/infer.py --model_dir=output_inference/${job_name} --image_file=demo/000000014439_640x640.jpg --device=GPU
# 6.deploy speed, add '--run_mode=trt_fp16' to test in TensorRT FP16 mode
CUDA_VISIBLE_DEVICES=0 python deploy/python/infer.py --model_dir=output_inference/${job_name} --image_file=demo/000000014439_640x640.jpg --device=GPU --run_benchmark=True # --run_mode=trt_fp16
# 7.export onnx
paddle2onnx --model_dir output_inference/${job_name} --model_filename model.pdmodel --params_filename model.pdiparams --opset_version 12 --save_file ${job_name}.onnx
# 8.onnx speed
/usr/local/TensorRT-8.0.3.4/bin/trtexec --onnx=${job_name}.onnx --workspace=4096 --avgRuns=10 --shapes=input:1x3x640x640 --fp16
/usr/local/TensorRT-8.0.3.4/bin/trtexec --onnx=${job_name}.onnx --workspace=4096 --avgRuns=10 --shapes=input:1x3x640x640 --fp32
Note:
- If you want to switch models, just modify the first two lines, such as:
model_name=yolov7 job_name=yolov7_tiny_300e_coco
- For exporting onnx, you should install Paddle2ONNX by
pip install paddle2onnx
at first. - For FLOPs(G) and Params(M), you should install PaddleSlim by
pip install paddleslim
at first, then setprint_flops: True
andprint_params: True
in runtime.yml. Make sure single scale like 640x640, MACs are printed,FLOPs=2*MACs.
[Training Custom dataset](PaddlePaddle#43)
- Please refer to doc and issue.
- PaddleDetection team provides various feature detection models based on PP-YOLOE , which can also be used as a reference to modify on your custom dataset. Please refer to PP-YOLOE application, pphuman, ppvehicle, visdrone and smalldet.
- PaddleDetection also provides various YOLO models for VOC dataset , which can also be used as a reference to modify on your custom dataset. Please refer to voc.
- Please ensure the corresponding COCO trained weights are loaded as pre-train weights at first. Set the
pretrain_weights:
with corresponding COCO trained weights in the config file, and it will generally prompt that the number of channels convolved by the head classification layer does not correspond, which is a normal phenomenon, because the number of types of user-defined data sets is generally inconsistent with that of COCO data sets. - We recommend to use YOLO detection model with a total
batch_size
at least greater than64
to train. If the resources are insufficient, please use the smaller model or reduce the input size of the model. To ensure high detection accuracy, you'd better not try to using single GPU or totalbatch_size
less than64
for training;
- 【2023/03/13】Support YOLOv5u and YOLOv7u inference and deploy;
- 【2023/01/10】Support YOLOv8 inference and deploy;
- 【2022/09/29】Support RTMDet inference and deploy;
- 【2022/09/26】Release PaddleYOLO, see ModelZoo;
- 【2022/09/19】Support the new version of YOLOv6, including n/t/s/m/l model;
- 【2022/08/23】Release
YOLOSeries
codebase: supportYOLOv3
,PP-YOLOE
,PP-YOLOE+
,YOLOX
,YOLOv5
,YOLOv6
andYOLOv7
; support usingConvNeXt
backbone to get high-precision version ofPP-YOLOE
,YOLOX
andYOLOv5
; support PaddleSlim accelerated quantitative trainingPP-YOLOE
,YOLOv5
,YOLOv6
andYOLOv7
. For details, please read this article;
-
🔥 2023.3.14:Release PaddleYOLO release/2.6
- 💡 Model kit:
- Support
YOLOv8
,YOLOv5u
,YOLOv7u
inference and deploy. - Support
Swin-Transformer
、ViT
、FocalNet
backbone to get high-precision version ofPP-YOLOE+
. - Support
YOLOv8
in FastDeploy.
- Support
- 💡 Model kit:
-
🔥 2022.9.26:Release PaddleYOLO release/2.5
- 💡 Model kit:
- Release PaddleYOLO: support
YOLOv3
,PP-YOLOE
,PP-YOLOE+
,YOLOX
,YOLOv5
,YOLOv6
andYOLOv7
; support usingConvNeXt
backbone to get high-precision version ofPP-YOLOE
,YOLOX
andYOLOv5
; support PaddleSlim accelerated quantitative trainingPP-YOLOE
,YOLOv5
,YOLOv6
andYOLOv7
.
- Release PaddleYOLO: support
- 💡 Model kit:
-
🔥 2022.8.26:PaddleDetection release/2.5 version
-
🗳 Model features:
- Release PP-YOLOE+: Increased accuracy by a maximum of 2.4% mAP to 54.9% mAP, 3.75 times faster model training convergence rate, and up to 2.3 times faster end-to-end inference speed; improved generalization for multiple downstream tasks
- Release PicoDet-NPU model which supports full quantization deployment of models; add PicoDet layout analysis model
- Release PP-TinyPose Plus. With 9.1% AP accuracy improvement in physical exercise, dance, and other scenarios, our PP-TinyPose Plus supports unconventional movements such as turning to one side, lying down, jumping, and high lifts
-
🔮 Functions in different scenarios
- Release the pedestrian analysis tool PP-Human v2. It introduces four new behavior recognition: fighting, telephoning, smoking, and trespassing. The underlying algorithm performance is optimized, covering three core algorithm capabilities: detection, tracking, and attributes of pedestrians. Our model provides end-to-end development and model optimization strategies for beginners and supports online video streaming input.
- First release PP-Vehicle, which has four major functions: license plate recognition, vehicle attribute analysis (color, model), traffic flow statistics, and violation detection. It is compatible with input formats, including pictures, online video streaming, and video. And we also offer our users a comprehensive set of tutorials for customization.
-
💡 Cutting-edge algorithms:
- Covers YOLO family classic and latest models: YOLOv3, PP-YOLOE (a real-time high-precision object detection model developed by Baidu PaddlePaddle), and cutting-edge detection algorithms such as YOLOv4, YOLOv5, YOLOX, YOLOv6, and YOLOv7
- Newly add high precision detection model based on ViT backbone network, with a 55.7% mAP accuracy on COCO dataset; newly add multi-object tracking model OC-SORT; newly add ConvNeXt backbone network.
-
📋 Industrial applications: Newly add Smart Fitness, Fighting recognition, and Visitor Analysis.
-
-
2022.3.24:PaddleDetection releasedrelease/2.4 version
- Release high-performanace SOTA object detection model PP-YOLOE. It integrates cloud and edge devices and provides S/M/L/X versions. In particular, Verson L has the accuracy as 51.4% on COCO test 2017 dataset, inference speed as 78.1 FPS on a single Test V100. It supports mixed precision training, 33% faster than PP-YOLOv2. Its full range of multi-sized models can meet different hardware arithmetic requirements, and adaptable to server, edge-device GPU and other AI accelerator cards on servers.
- Release ultra-lightweight SOTA object detection model PP-PicoDet Plus with 2% improvement in accuracy and 63% improvement in CPU inference speed. Add PicoDet-XS model with a 0.7M parameter, providing model sparsification and quantization functions for model acceleration. No specific post processing module is required for all the hardware, simplifying the deployment.
- Release the real-time pedestrian analysis tool PP-Human. It has four major functions: pedestrian tracking, visitor flow statistics, human attribute recognition and falling detection. For falling detection, it is optimized based on real-life data with accurate recognition of various types of falling posture. It can adapt to different environmental background, light and camera angle.
- Add YOLOX object detection model with nano/tiny/S/M/L/X. X version has the accuracy as 51.8% on COCO Val2017 dataset.
PaddleDetection is an end-to-end object detection development kit based on PaddlePaddle. Providing over 30 model algorithm and over 250 pre-trained models, it covers object detection, instance segmentation, keypoint detection, multi-object tracking. In particular, PaddleDetection offers high- performance & light-weight industrial SOTA models on servers and mobile devices, champion solution and cutting-edge algorithm. PaddleDetection provides various data augmentation methods, configurable network components, loss functions and other advanced optimization & deployment schemes. In addition to running through the whole process of data processing, model development, training, compression and deployment, PaddlePaddle also provides rich cases and tutorials to accelerate the industrial application of algorithm.
- Rich model library: PaddleDetection provides over 250 pre-trained models including object detection, instance segmentation, face recognition, multi-object tracking. It covers a variety of global competition champion schemes.
- Simple to use: Modular design, decoupling each network component, easy for developers to build and try various detection models and optimization strategies, quick access to high-performance, customized algorithm.
- Getting Through End to End: PaddlePaddle gets through end to end from data augmentation, constructing models, training, compression, depolyment. It also supports multi-architecture, multi-device deployment for cloud and edge device.
- High Performance: Due to the high performance core, PaddlePaddle has clear advantages in training speed and memory occupation. It also supports FP16 training and multi-machine training.
-
If you have any question or suggestion, please give us your valuable input via GitHub Issues
Welcome to join PaddleDetection user groups on WeChat (scan the QR code, add and reply "D" to the assistant)
Architectures | Backbones | Components | Data Augmentation |
Object Detection |
Details
|
Common
FPN
Loss
Post-processing
Speed
|
Details
|
Performance comparison of Cloud models
The comparison between COCO mAP and FPS on Tesla V100 of representative models of each architectures and backbones.
Clarification:
PP-YOLOE
are optimizedPP-YOLO v2
. It reached accuracy as 51.4% on COCO dataset, inference speed as 78.1 FPS on Tesla V100PP-YOLOE+
are optimizedPP-YOLOE
. It reached accuracy as 53.3% on COCO dataset, inference speed as 78.1 FPS on Tesla V100- The models in the figure are available in the model library
Performance omparison on mobiles
The comparison between COCO mAP and FPS on Qualcomm Snapdragon 865 processor of models on mobile devices.
Clarification:
- Tests were conducted on Qualcomm Snapdragon 865 (4 *A77 + 4 *A55) batch_size=1, 4 thread, and NCNN inference library, test script see MobileDetBenchmark
- PP-PicoDet and PP-YOLO-Tiny are self-developed models of PaddleDetection, and other models are not tested yet.
1. General detection
PP-YOLOE series Recommended scenarios: Cloud GPU such as Nvidia V100, T4 and edge devices such as Jetson series
Model | COCO Accuracy(mAP) | V100 TensorRT FP16 Speed(FPS) | Configuration | Download |
---|---|---|---|---|
PP-YOLOE+_s | 43.9 | 333.3 | link | download |
PP-YOLOE+_m | 50.0 | 208.3 | link | download |
PP-YOLOE+_l | 53.3 | 149.2 | link | download |
PP-YOLOE+_x | 54.9 | 95.2 | link | download |
Model | COCO Accuracy(mAP) | V100 TensorRT FP16 speed(FPS) | Configuration | Download |
---|---|---|---|---|
YOLOX-l | 50.1 | 107.5 | Link | Download |
YOLOv5-l | 48.6 | 136.0 | Link | Download |
YOLOv7-l | 51.0 | 135.0 | 链接 | 下载地址 |
- Installation
- Quick start
- Data preparation
- Geting Started on PaddleDetection
- [FAQ]((docs/tutorials/FAQ)
-
Configuration
-
Compression based on PaddleSlim
-
Advanced development
Please refer to the Release note for more details about the updates
PaddleYOLO is provided under the GPL-3.0 license
@misc{ppdet2019,
title={PaddleDetection, Object detection and instance segmentation toolkit based on PaddlePaddle.},
author={PaddlePaddle Authors},
howpublished = {\url{https://github.com/PaddlePaddle/PaddleDetection}},
year={2019}
}