YOLOv6

Introduction

YOLOv6 is a single-stage object detection framework dedicated to industrial application, with hardware-friendly efficient design and high performance.

YOLOv6-nano achieves 35.0 mAP on COCOval dataset with 1242 FPS on T4 using TensorRT FP16 for bs32 inference, and YOLOv6-s achieves 43.1 mAP on COCOval dataset with 520 FPS on T4 using TensorRT FP16 for bs32 inference.

YOLOv6 is composed of following methods:

  • Hardware-friendly Design for Backbone and Neck
  • Efficient Decoupled Head with SIoU loss

Coming soon

  • YOLOv6 m/l/x model.
  • Deployment for OPENVINO/MNN/TNN/NCNN…

Quick Start

Install

git clone https://github.com/meituan/YOLOv6
cd YOLOv6
pip install -r requirements.txt  

Inference

First, download a pretrained model from the YOLOv6 release

Second, run inference with tools/infer.py

python tools/infer.py --weights yolov6s.pt --source [img.jpg / imgdir]
                                yolov6n.pt  

Training

Single GPU

python tools/train.py --batch 256 --conf configs/yolov6s.py --data data/coco.yaml --device 0
                                         configs/yolov6n.py

Multi GPUs (DDP mode recommended)

python -m torch.distributed.launch --nproc_per_node 8 tools/train.py --batch 256 --conf configs/yolov6s.py --data data/coco.yaml --device 0,1,2,3,4,5,6,7
                                                                                        configs/yolov6n.py
  • conf: select config file to specify network/optimizer/hyperparameters
  • data: prepare COCO dataset and specify dataset paths in data.yaml

Evaluation

Reproduce mAP on COCO val2017 dataset

python tools/eval.py --data data/coco.yaml  --batch 32 --weights yolov6s.pt --task val
                                                                 yolov6n.pt

Deployment

Export as ONNX Format

python tools/export_onnx.py --weights yolov6s.pt --device 0
                                      yolov6n.pt

Tutorials

Benchmark

Model Size mAPval0.5:0.95 SpeedV100fp16 b32 (ms) SpeedV100fp32 b32 (ms) SpeedT4 trt fp16 b1 (fps) SpeedT4 trt fp16 b32 (fps) Params (M) Flops (G)
YOLOv6-n 416640 30.835.0 0.30.5 0.40.7 1100788 27161242 4.34.3 4.711.1
YOLOv6-tiny 640 41.3 0.9 1.5 425 602 15.0 36.7
YOLOv6-s 640 43.1 1.0 1.7 373 520 17.2 44.2
  • Comparison of the mAP and speed of different object detectors tested on COCO val2017 dataset.
  • Speed results are tested in our environment using official codebase and model if not found from the corresponding official release.
  • Params and Flops of yolov6 are estimated on deploy model.

GitHub

View Github