Home

Awesome

<div align="center"><img src="assets/logo.png" width="350"></div> <img src="assets/demo.png" >

Introduction

YOLOX is an anchor-free version of YOLO, with a simpler design but better performance! It aims to bridge the gap between research and industrial communities. For more details, please refer to our report on Arxiv.

This repo is an implementation of PyTorch version YOLOX, there is also a MegEngine implementation.

<img src="assets/git_fig.png" width="1000" >

Updates!!

Benchmark

Standard Models.

ModelsizemAP<sup>val<br>0.5:0.95mAP<sup>test<br>0.5:0.95Speed V100<br>(ms)Params<br>(M)FLOPs<br>(G)weights
YOLOX-s64040.540.59.89.026.8github
YOLOX-m64046.947.212.325.373.8github
YOLOX-l64049.750.114.554.2155.6github
YOLOX-x64051.151.517.399.1281.9github
YOLOX-Darknet5364047.748.011.163.7185.3github
<details> <summary>Legacy models</summary>
ModelsizemAP<sup>test<br>0.5:0.95Speed V100<br>(ms)Params<br>(M)FLOPs<br>(G)weights
YOLOX-s64039.69.89.026.8onedrive/github
YOLOX-m64046.412.325.373.8onedrive/github
YOLOX-l64050.014.554.2155.6onedrive/github
YOLOX-x64051.217.399.1281.9onedrive/github
YOLOX-Darknet5364047.411.163.7185.3onedrive/github
</details>

Light Models.

ModelsizemAP<sup>val<br>0.5:0.95Params<br>(M)FLOPs<br>(G)weights
YOLOX-Nano41625.80.911.08github
YOLOX-Tiny41632.85.066.45github
<details> <summary>Legacy models</summary>
ModelsizemAP<sup>val<br>0.5:0.95Params<br>(M)FLOPs<br>(G)weights
YOLOX-Nano41625.30.911.08github
YOLOX-Tiny41632.85.066.45github
</details>

Quick Start

<details> <summary>Installation</summary>

Step1. Install YOLOX from source.

git clone git@github.com:Megvii-BaseDetection/YOLOX.git
cd YOLOX
pip3 install -v -e .  # or  python3 setup.py develop
</details> <details> <summary>Demo</summary>

Step1. Download a pretrained model from the benchmark table.

Step2. Use either -n or -f to specify your detector's config. For example:

python tools/demo.py image -n yolox-s -c /path/to/your/yolox_s.pth --path assets/dog.jpg --conf 0.25 --nms 0.45 --tsize 640 --save_result --device [cpu/gpu]

or

python tools/demo.py image -f exps/default/yolox_s.py -c /path/to/your/yolox_s.pth --path assets/dog.jpg --conf 0.25 --nms 0.45 --tsize 640 --save_result --device [cpu/gpu]

Demo for video:

python tools/demo.py video -n yolox-s -c /path/to/your/yolox_s.pth --path /path/to/your/video --conf 0.25 --nms 0.45 --tsize 640 --save_result --device [cpu/gpu]
</details> <details> <summary>Reproduce our results on COCO</summary>

Step1. Prepare COCO dataset

cd <YOLOX_HOME>
ln -s /path/to/your/COCO ./datasets/COCO

Step2. Reproduce our results on COCO by specifying -n:

python -m yolox.tools.train -n yolox-s -d 8 -b 64 --fp16 -o [--cache]
                               yolox-m
                               yolox-l
                               yolox-x

When using -f, the above commands are equivalent to:

python -m yolox.tools.train -f exps/default/yolox_s.py -d 8 -b 64 --fp16 -o [--cache]
                               exps/default/yolox_m.py
                               exps/default/yolox_l.py
                               exps/default/yolox_x.py

Multi Machine Training

We also support multi-nodes training. Just add the following args:

Suppose you want to train YOLOX on 2 machines, and your master machines's IP is 123.123.123.123, use port 12312 and TCP.

On master machine, run

python tools/train.py -n yolox-s -b 128 --dist-url tcp://123.123.123.123:12312 --num_machines 2 --machine_rank 0

On the second machine, run

python tools/train.py -n yolox-s -b 128 --dist-url tcp://123.123.123.123:12312 --num_machines 2 --machine_rank 1

Logging to Weights & Biases

To log metrics, predictions and model checkpoints to W&B use the command line argument --logger wandb and use the prefix "wandb-" to specify arguments for initializing the wandb run.

python tools/train.py -n yolox-s -d 8 -b 64 --fp16 -o [--cache] --logger wandb wandb-project <project name>
                         yolox-m
                         yolox-l
                         yolox-x

An example wandb dashboard is available here

Others

See more information with the following command:

python -m yolox.tools.train --help
</details> <details> <summary>Evaluation</summary>

We support batch testing for fast evaluation:

python -m yolox.tools.eval -n  yolox-s -c yolox_s.pth -b 64 -d 8 --conf 0.001 [--fp16] [--fuse]
                               yolox-m
                               yolox-l
                               yolox-x

To reproduce speed test, we use the following command:

python -m yolox.tools.eval -n  yolox-s -c yolox_s.pth -b 1 -d 1 --conf 0.001 --fp16 --fuse
                               yolox-m
                               yolox-l
                               yolox-x
</details> <details> <summary>Tutorials</summary> </details>

Deployment

  1. MegEngine in C++ and Python
  2. ONNX export and an ONNXRuntime
  3. TensorRT in C++ and Python
  4. ncnn in C++ and Java
  5. OpenVINO in C++ and Python
  6. Accelerate YOLOX inference with nebullvm in Python

Third-party resources

Cite YOLOX

If you use YOLOX in your research, please cite our work by using the following BibTeX entry:

 @article{yolox2021,
  title={YOLOX: Exceeding YOLO Series in 2021},
  author={Ge, Zheng and Liu, Songtao and Wang, Feng and Li, Zeming and Sun, Jian},
  journal={arXiv preprint arXiv:2107.08430},
  year={2021}
}

In memory of Dr. Jian Sun

Without the guidance of Dr. Jian Sun, YOLOX would not have been released and open sourced to the community. The passing away of Dr. Sun is a huge loss to the Computer Vision field. We add this section here to express our remembrance and condolences to our captain Dr. Sun. It is hoped that every AI practitioner in the world will stick to the belief of "continuous innovation to expand cognitive boundaries, and extraordinary technology to achieve product value" and move forward all the way.

<div align="center"><img src="assets/sunjian.png" width="200"></div> 没有孙剑博士的指导,YOLOX也不会问世并开源给社区使用。 孙剑博士的离去是CV领域的一大损失,我们在此特别添加了这个部分来表达对我们的“船长”孙老师的纪念和哀思。 希望世界上的每个AI从业者秉持着“持续创新拓展认知边界,非凡科技成就产品价值”的观念,一路向前。