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
Nodule Generation Algorithm Baseline and template code for node21 generation track

Nodule Generation Algorithm This codebase implements a simple baseline model, by following the main steps in the paper published by Litjens et al. for

node21challenge 10 Apr 21, 2022
Chatbot in 200 lines of code using TensorLayer

Seq2Seq Chatbot This is a 200 lines implementation of Twitter/Cornell-Movie Chatbot, please read the following references before you read the code: Pr

TensorLayer Community 820 Dec 17, 2022
Repository for the paper : Meta-FDMixup: Cross-Domain Few-Shot Learning Guided byLabeled Target Data

1 Meta-FDMIxup Repository for the paper : Meta-FDMixup: Cross-Domain Few-Shot Learning Guided byLabeled Target Data. (ACM MM 2021) paper News! the rep

Fu Yuqian 44 Nov 18, 2022
load .txt to train YOLOX, same as Yolo others

YOLOX train your data you need generate data.txt like follow format (per line- one image). prepare one data.txt like this: img_path1 x1,y1,x2,y2,clas

LiMingf 18 Aug 18, 2022
Official code for "Towards An End-to-End Framework for Flow-Guided Video Inpainting" (CVPR2022)

E2FGVI (CVPR 2022) English | 简体中文 This repository contains the official implementation of the following paper: Towards An End-to-End Framework for Flo

Media Computing Group @ Nankai University 537 Jan 07, 2023
Object detection on multiple datasets with an automatically learned unified label space.

Simple multi-dataset detection An object detector trained on multiple large-scale datasets with a unified label space; Winning solution of E

Xingyi Zhou 407 Dec 30, 2022
I created My own Virtual Artificial Intelligence named genesis, He can assist with my Tasks and also perform some analysis,,

Virtual-Artificial-Intelligence-genesis- I created My own Virtual Artificial Intelligence named genesis, He can assist with my Tasks and also perform

AKASH M 1 Nov 05, 2021
The lightweight PyTorch wrapper for high-performance AI research. Scale your models, not the boilerplate.

The lightweight PyTorch wrapper for high-performance AI research. Scale your models, not the boilerplate. Website • Key Features • How To Use • Docs •

Pytorch Lightning 21.1k Dec 29, 2022
Framework for evaluating ANNS algorithms on billion scale datasets.

Billion-Scale ANN http://big-ann-benchmarks.com/ Install The only prerequisite is Python (tested with 3.6) and Docker. Works with newer versions of Py

Harsha Vardhan Simhadri 132 Dec 24, 2022
A pytorch implementation of Pytorch-Sketch-RNN

Pytorch-Sketch-RNN A pytorch implementation of https://arxiv.org/abs/1704.03477 In order to draw other things than cats, you will find more drawing da

Alexis David Jacq 172 Dec 12, 2022
Leveraging Social Influence based on Users Activity Centers for Point-of-Interest Recommendation

SUCP Leveraging Social Influence based on Users Activity Centers for Point-of-Interest Recommendation () Direct Friends (i.e., users who follow each o

Kosar 8 Nov 26, 2022
Code accompanying the paper on "An Empirical Investigation of Domain Generalization with Empirical Risk Minimizers" published at NeurIPS, 2021

Code for "An Empirical Investigation of Domian Generalization with Empirical Risk Minimizers" (NeurIPS 2021) Motivation and Introduction Domain Genera

Meta Research 15 Dec 27, 2022
Videocaptioning.pytorch - A simple implementation of video captioning

pytorch implementation of video captioning recommend installing pytorch and pyth

Yiyu Wang 2 Jan 01, 2022
Code for the paper "PortraitNet: Real-time portrait segmentation network for mobile device" @ CAD&Graphics2019

PortraitNet Code for the paper "PortraitNet: Real-time portrait segmentation network for mobile device". @ CAD&Graphics 2019 Introduction We propose a

265 Dec 01, 2022
Galactic and gravitational dynamics in Python

Gala is a Python package for Galactic and gravitational dynamics. Documentation The documentation for Gala is hosted on Read the docs. Installation an

Adrian Price-Whelan 101 Dec 22, 2022
Keras implementation of PersonLab for Multi-Person Pose Estimation and Instance Segmentation.

PersonLab This is a Keras implementation of PersonLab for Multi-Person Pose Estimation and Instance Segmentation. The model predicts heatmaps and vari

OCTI 160 Dec 21, 2022
A curated list of long-tailed recognition resources.

Awesome Long-tailed Recognition A curated list of long-tailed recognition and related resources. Please feel free to pull requests or open an issue to

Zhiwei ZHANG 542 Jan 01, 2023
Learning to Identify Top Elo Ratings with A Dueling Bandits Approach

Learning to Identify Top Elo Ratings We propose two algorithms MaxIn-Elo and MaxIn-mElo to solve the top players identification on the transitive and

2 Jan 14, 2022
A Simulated Optimal Intrusion Response Game

Optimal Intrusion Response An OpenAI Gym interface to a MDP/Markov Game model for optimal intrusion response of a realistic infrastructure simulated u

Kim Hammar 10 Dec 09, 2022
ROS-UGV-Control-Interface - Control interface which can be used in any UGV

ROS-UGV-Control-Interface Cam Closed: Cam Opened:

Ahmet Fatih Akcan 1 Nov 04, 2022