YOLOX-Paddle - A reproduction of YOLOX by PaddlePaddle

Overview

YOLOX-Paddle

A reproduction of YOLOX by PaddlePaddle

数据集准备

下载COCO数据集,准备为如下路径

/home/aistudio
|-- COCO
|   |-- annotions
|   |-- train2017
|   |-- val2017

除了常用的图像处理库,需要安装额外的包

pip install gputil==1.4.0 loguru pycocotools

进入仓库根目录,编译安装(推荐使用AIStudio

cd YOLOX-Paddle
pip install -v -e .

如果使用本地机器出现编译失败,需要修改YOLOX-Paddle/yolox/layers/csrc/cocoeval/cocoeval.h中导入pybind11的include文件为本机目录,使用如下命令获取pybind11include目录

>>> import pybind11
>>> pybind11.get_include()
'/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/pybind11/include'

AIStudio路径

#include </opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/pybind11/include/pybind11/numpy.h>
#include </opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/pybind11/include/pybind11/pybind11.h>
#include </opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/pybind11/include/pybind11/stl.h>
#include </opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/pybind11/include/pybind11/stl_bind.h>

成功后使用pip list可看到安装模块

yolox    0.1.0    /home/aistudio/YOLOX-Paddle

设置YOLOX_DATADIR环境变量\或者`ln -s /path/to/your/COCO ./datasets/COCO`来指定COCO数据集位置

export YOLOX_DATADIR=/home/aistudio/

训练

python tools/train.py -n yolox-nano -d 1 -b 64

得到的权重保存至./YOLOX_outputs/nano/yolox_nano.pdparams

验证

python tools/eval.py -n yolox-nano -c ./YOLOX_outputs/nano/yolox_nano.pdparams -b 64 -d 1 --conf 0.001
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.259
 Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.416
 Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = 0.269
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.083
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.274
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.413
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=  1 ] = 0.242
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets= 10 ] = 0.384
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.419
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.154
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.470
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.632

并提供了官方预训练权重,code:ybxc

Model size mAPval
0.5:0.95
mAPtest
0.5:0.95
Speed V100
(ms)
Params
(M)
FLOPs
(G)
YOLOX-s 640 40.5 40.5 9.8 9.0 26.8
YOLOX-m 640 46.9 47.2 12.3 25.3 73.8
YOLOX-l 640 49.7 50.1 14.5 54.2 155.6
YOLOX-x 640 51.1 51.5 17.3 99.1 281.9
YOLOX-Darknet53 640 47.7 48.0 11.1 63.7 185.3

推理

python tools/demo.py image -n yolox-nano -c ./YOLOX_outputs/nano/yolox_nano.pdparams --path assets/dog.jpg --conf 0.25 --nms 0.45 --tsize 640 --save_result

推理结果如下所示

Train Custom Data

相信这是大部分开发者最关心的事情,本章节参考如下仓库,本仓库现已集成

  • Converting darknet or yolov5 datasets to COCO format for YOLOX: YOLO2COCO from Daniel

数据准备

我们同样以YOLOv5格式的光栅数据集为例,可在此处下载 进入仓库根目录,下载解压,数据集应该具有如下目录:

YOLOX-Paddle
|-- guangshan
|   |-- images
|      |-- train
|      |-- val
|   |-- labels
|      |-- train
|      |-- val

现在运行如下命令

bash prepare.sh

然后添加一个classes.txt,你应该得到如下目录,并在生成的YOLOV5_COCO_format得到COCO数据格式的数据集:

YOLOX-Paddle/YOLO2COCO/dataset
|-- YOLOV5
|   |-- guangshan
|   |   |-- images
|   |   |-- labels
|   |-- train.txt
|   |-- val.txt
|   |-- classes.txt
|-- YOLOV5_COCO_format
|   |-- train2017
|   |-- val2017
|   |-- annotations

可参考YOLOV5_COCO_format下的README.md

训练、验证、推理

配置custom训练文件YOLOX-Paddle/exps/example/custom/nano.py,修改self.num_classes为你的类别数,其余配置可根据喜好调参,使用如下命令启动训练

python tools/train.py -f ./exps/example/custom/nano.py -n yolox-nano -d 1 -b 8

使用如下命令启动验证

python tools/eval.py -f ./exps/example/custom/nano.py -n yolox-nano -c ./YOLOX_outputs_custom/nano/best_ckpt.pdparams -b 64 -d 1 --conf 0.001

使用如下命令启动推理

python tools/demo.py image -f ./exps/example/custom/nano.py -n yolox-nano -c ./YOLOX_outputs_custom/nano/best_ckpt.pdparams --path test.jpg --conf 0.25 --nms 0.45 --tsize 640 --save_result

其余部分参考COCO数据集,整个训练文件保存在YOLOX_outputs_custom文件夹

关于作者

姓名 郭权浩
学校 电子科技大学研2020级
研究方向 计算机视觉
CSDN主页 Deep Hao的CSDN主页
GitHub主页 Deep Hao的GitHub主页
如有错误,请及时留言纠正,非常蟹蟹!
后续会有更多论文复现系列推出,欢迎大家有问题留言交流学习,共同进步成长!
Owner
QuanHao Guo
Master at UESTC
QuanHao Guo
The spiritual successor to knockknock for PyTorch Lightning, get notified when your training ends

Who's there? The spiritual successor to knockknock for PyTorch Lightning, to get a notification when your training is complete or when it crashes duri

twsl 70 Oct 06, 2022
Brain tumor detection using Convolution-Neural Network (CNN)

Detect and Classify Brain Tumor using CNN. A system performing detection and classification by using Deep Learning Algorithms using Convolution-Neural Network (CNN).

assia 1 Feb 07, 2022
A set of tests for evaluating large-scale algorithms for Wasserstein-2 transport maps computation.

Continuous Wasserstein-2 Benchmark This is the official Python implementation of the NeurIPS 2021 paper Do Neural Optimal Transport Solvers Work? A Co

Alexander 22 Dec 12, 2022
Repository for the paper "Exploring the Sensory Spaces of English Perceptual Verbs in Natural Language Data"

Sensory Spaces of English Perceptual Verbs This repository contains the code and collocational data described in the paper "Exploring the Sensory Spac

David Peng 0 Sep 07, 2021
Official repository of IMPROVING DEEP IMAGE MATTING VIA LOCAL SMOOTHNESS ASSUMPTION.

IMPROVING DEEP IMAGE MATTING VIA LOCAL SMOOTHNESS ASSUMPTION This is the official repository of IMPROVING DEEP IMAGE MATTING VIA LOCAL SMOOTHNESS ASSU

电线杆 14 Dec 15, 2022
🗣️ Microsoft Edge TTS for Home Assistant, no need for app_key

Microsoft Edge TTS for Home Assistant This component is based on the TTS service of Microsoft Edge browser, no need to apply for app_key. Install Down

152 Dec 31, 2022
EDPN: Enhanced Deep Pyramid Network for Blurry Image Restoration

EDPN: Enhanced Deep Pyramid Network for Blurry Image Restoration Ruikang Xu, Zeyu Xiao, Jie Huang, Yueyi Zhang, Zhiwei Xiong. EDPN: Enhanced Deep Pyra

69 Dec 15, 2022
Official codebase used to develop Vision Transformer, MLP-Mixer, LiT and more.

Big Vision This codebase is designed for training large-scale vision models on Cloud TPU VMs. It is based on Jax/Flax libraries, and uses tf.data and

Google Research 701 Jan 03, 2023
Resilient projection-based consensus actor-critic (RPBCAC) algorithm

Resilient projection-based consensus actor-critic (RPBCAC) algorithm We implement the RPBCAC algorithm with nonlinear approximation from [1] and focus

Martin Figura 5 Jul 12, 2022
NATS-Bench: Benchmarking NAS Algorithms for Architecture Topology and Size

NATS-Bench: Benchmarking NAS Algorithms for Architecture Topology and Size Xuanyi Dong, Lu Liu, Katarzyna Musial, Bogdan Gabrys in IEEE Transactions o

D-X-Y 137 Dec 20, 2022
Code for the Paper: Alexandra Lindt and Emiel Hoogeboom.

Discrete Denoising Flows This repository contains the code for the experiments presented in the paper Discrete Denoising Flows [1]. To give a short ov

Alexandra Lindt 3 Oct 09, 2022
Forecasting with Gradient Boosted Time Series Decomposition

ThymeBoost ThymeBoost combines time series decomposition with gradient boosting to provide a flexible mix-and-match time series framework for spicy fo

131 Jan 08, 2023
Fast RFC3339 compliant Python date-time library

udatetime: Fast RFC3339 compliant date-time library Handling date-times is a painful act because of the sheer endless amount of formats used by people

Simon Pirschel 235 Oct 25, 2022
S-attack library. Official implementation of two papers "Are socially-aware trajectory prediction models really socially-aware?" and "Vehicle trajectory prediction works, but not everywhere".

S-attack library: A library for evaluating trajectory prediction models This library contains two research projects to assess the trajectory predictio

VITA lab at EPFL 71 Jan 04, 2023
Fantasy Points Prediction and Dream Team Formation

Fantasy-Points-Prediction-and-Dream-Team-Formation Collected Data from open source resources that have over 100 Parameters for predicting cricket play

Akarsh Singh 2 Sep 13, 2022
LegoDNN: a block-grained scaling tool for mobile vision systems

Table of contents 1 Introduction 1.1 Major features 1.2 Architecture 2 Code and Installation 2.1 Code 2.2 Installation 3 Repository of DNNs in vision

41 Dec 24, 2022
Library for 8-bit optimizers and quantization routines.

bitsandbytes Bitsandbytes is a lightweight wrapper around CUDA custom functions, in particular 8-bit optimizers and quantization functions. Paper -- V

Facebook Research 687 Jan 04, 2023
(ICCV'21) Official PyTorch implementation of Relational Embedding for Few-Shot Classification

Relational Embedding for Few-Shot Classification (ICCV 2021) Dahyun Kang, Heeseung Kwon, Juhong Min, Minsu Cho [paper], [project hompage] We propose t

Dahyun Kang 82 Dec 24, 2022
CVPR2021 Content-Aware GAN Compression

Content-Aware GAN Compression [ArXiv] Paper accepted to CVPR2021. @inproceedings{liu2021content, title = {Content-Aware GAN Compression}, auth

52 Nov 06, 2022