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 MegEngine version YOLOX, there is also a PyTorch implementation.

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

Updates!!

Comming soon

Benchmark

Light Models.

ModelsizemAP<sup>val<br>0.5:0.95Params<br>(M)FLOPs<br>(G)weights
YOLOX-Tiny41632.25.066.45github

Standard Models.

Comming soon!

Quick Start

<details> <summary>Installation</summary>

Step1. Install YOLOX.

git clone git@github.com:MegEngine/YOLOX.git
cd YOLOX
pip3 install -U pip && pip3 install -r requirements.txt
pip3 install -v -e .  # or  python3 setup.py develop

Step2. Install pycocotools.

pip3 install cython; pip3 install 'git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI'
</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-tiny -c /path/to/your/yolox_tiny.pkl --path assets/dog.jpg --conf 0.25 --nms 0.45 --tsize 416 --save_result --device [cpu/gpu]

or

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

Demo for video:

python tools/demo.py video -n yolox-s -c /path/to/your/yolox_s.pkl --path /path/to/your/video --conf 0.25 --nms 0.45 --tsize 416 --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 tools/train.py -n yolox-tiny -d 8 -b 128

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

python tools/train.py -f exps/default/yolox-tiny.py -d 8 -b 128
</details> <details> <summary>Evaluation</summary>

We support batch testing for fast evaluation:

python tools/eval.py -n  yolox-tiny -c yolox_tiny.pkl -b 64 -d 8 --conf 0.001 [--fuse]

To reproduce speed test, we use the following command:

python tools/eval.py -n  yolox-tiny -c yolox_tiny.pkl -b 1 -d 1 --conf 0.001 --fuse
</details> <details> <summary>Tutorials</summary> </details>

MegEngine Deployment

MegEngine in C++

<details> <summary>Dump mge file</summary>

NOTE: result model is dumped with optimize_for_inference and enable_fuse_conv_bias_nonlinearity.

python3 tools/export_mge.py -n yolox-tiny -c yolox_tiny.pkl --dump_path yolox_tiny.mge
</details>

Benchmark

megengine@tag1.5 +fastrun +weight_preprocess (msec)1 thread2 thread4 thread8 thread
x86_64(fp32)516.245318.29253.273222.534
x86_64(fp32+chw88)362.020NONENONENONE
aarch64(fp32+chw44)555.877351.371242.044NONE
aarch64(fp16+chw)439.606327.356255.531NONE
CUDA @ CUDA (msec)1 batch2 batch4 batch8 batch16 batch32 batch64 batch
megengine(fp32+chw)8.13713.289323.663344.47086.491168.95334.248

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}
}