EOD
Easy and Efficient Object Detector
EOD (Easy and Efficient Object Detection) is a general object detection model production framework. It aim on provide two key feature about Object Detection:
- Efficient: we will focus on training VERY HIGH ACCURARY single-shot detection model, and model compress (quantization/sparsity) will be heavy address.
- Easy: easy to use, easy to add new features(backbone/head/neck), easy to deploy.
- Large-Scale Dataset Training Detail
The master branch works with PyTorch 1.8.1. Due to the pytorch version, it can not well support the 30 series graphics card hardware.
Install
pip install -r requirments
Get Started
Some example scripts are supported in scripts/.
Export Module
Export eod into ROOT and PYTHONPATH
ROOT=../../
export ROOT=$ROOT
export PYTHONPATH=$ROOT:$PYTHONPATH
Train
Step1: edit meta_file and image_dir of image_reader:
dataset:
type: coco # dataset type
kwargs:
source: train
meta_file: coco/annotations/instances_train2017.json
image_reader:
type: fs_opencv
kwargs:
image_dir: coco/train2017
color_mode: BGR
Step2: train
python -m eod train --config configs/yolox/yolox_tiny.yaml --nm 1 --ng 8 --launch pytorch 2>&1 | tee log.train
- --config: yamls in configs/
- --nm: machine number
- --ng: gpu number for each machine
- --launch: slurm or pytorch
Step3: fp16, add fp16 setting into runtime config
runtime:
runner:
type: fp16
Eval
Step1: edit config of evaluating dataset
Step2: test
python -m eod train -e --config configs/yolox/yolox_tiny.yaml --nm 1 --ng 1 --launch pytorch 2>&1 | tee log.test
Demo
Step1: add visualizer config in yaml
inference:
visualizer:
type: plt
kwargs:
class_names: ['__background__', 'person'] # class names
thresh: 0.5
Step2: inference
python -m eod inference --config configs/yolox/yolox_tiny.yaml --ckpt ckpt_tiny.pth -i imgs -v vis_dir
- --ckpt: model for inferencing
- -i: images directory or single image
- -v: directory saving visualization results
Mpirun mode
EOD supports mpirun mode to launch task, MPI needs to be installed firstly
# download mpich
wget https://www.mpich.org/static/downloads/3.2.1/mpich-3.2.1.tar.gz # other versions: https://www.mpich.org/static/downloads/
tar -zxvf mpich-3.2.1.tar.gz
cd mpich-3.2.1
./configure --prefix=/usr/local/mpich-3.2.1
make && make install
Launch task
mpirun -np 8 python -m eod train --config configs/yolox/yolox_tiny.yaml --launch mpi 2>&1 | tee log.train
- Add mpirun -np x; x indicates number of processes
- Mpirun is convenient to debug with pdb
- --launch: mpi
Custom Example
Benckmark
Quick Run
Tutorials
Useful Tools
References
Acknowledgments
Thanks to all past contributors, especially opcoder,