/YOLOV3

yolov3 by pytorch

Primary LanguagePython

YOLOV3


Introduction

This is my own YOLOV3 written in pytorch, and is also the first time i have reproduced a object detection model.The dataset used is PASCAL VOC(not use difficulty). The eval tool is the voc2010. Now the mAP gains the goal score.

Subsequently, i will continue to update the code to make it more concise , and add the new and efficient tricks.


Results

name Train Dataset Val Dataset mAP(others) mAP(mine) notes
YOLOV3-448-544 2007trainval + 2012trainval 2007test 0.769 0.768 baseline(augument + step lr)
YOLOV3-*-544 2007trainval + 2012trainval 2007test 0.793 0.803 +multi-scale training

Note :

  • YOLOV3-448-544 means train image size is 448 and test image size is 544. "*" means the multi-scale.
  • In the test, the nms threshold is 0.5 and the conf_score is 0.01.
  • Now only support the single gpu to train and test.

Environment

  • Nvida GeForce RTX 2080 Ti
  • CUDA10.0
  • CUDNN7.0
  • ubuntu 16.04
# install packages
pip3 install -r requirements.txt --user

Brief

  • Data Augment (RandomHorizontalFlip, RandomCrop, RandomAffine, Resize)
  • Step lr Schedule
  • Multi-scale Training (320 to 640)
  • Mixup
  • Label smooth
  • GIOU
  • focal loss

Prepared work

1、Git clone YOLOV3 repository

git clone https://github.com/Peterisfar/YOLOV3.git

2、Download dataset

cd YOLOV3 && mkdir data
cd utils
python3 voc.py # get train_annotation.txt and test_annotation.txt in data/

3、Download pre-weight

Make dir weight/ in the YOLOV3 and put the weight file in.


Train

Run the following command to start training and see the details in the params.py

CFG_PATH=cfg/yolov3-voc.cfg
WEIGHT_PATH=weight

CUDA_VISIBLE_DEVICES=0 nohup python3 -u train.py --cfg_path $CFG_PATH --weight_path $WEIGHT_PATH --gpu_id 0 > nohup.log 2>&1 &

Notes:

  • Training steps could run the "cat nohup.log" to print the log.
  • It supports to resume training adding --resume, it will load last.pt automaticly.

Test

You should define your weight file path WEIGHT_FILE and images file path IMAGE_FILE

CFG_PATH=cfg/yolov3-voc.cfg
WEIGHT_PATH=weight
DATA_TEST=./data/test # your own images

CUDA_VISIBLE_DEVICES=0 python3 test.py --cfg_path $CFG_PATH --weight_path $WEIGHT_PATH --gpu_id 0 --visiual $DATA_TEST --eval

The images can be seen in the data/


TODO

  • Mish
  • OctvConv
  • Mobilenet v1-v3

Reference