Skip to content

reproduce object detection method such as yolov2, faster rcnn using pytorch

License

Notifications You must be signed in to change notification settings

pluto16/pytorch_detection

Repository files navigation

pytorch_detection

This is a pytorch implementaion of YOLO v2 whichi attempts to reproduce the results of project and the paper: YOLO9000: Better,Faster,Stronger by Joseph Redmon and Ali Farhadi.

This project is based on this project pytorch-yolo2

This repository tries to achieve the following goals

  • implement yolo v2 forward network using config yolo-voc.cfg
  • implement load darknet's yolo-voc.weights
  • implement detect.py
  • implement valid.py. This script produces results of pasval evaluation format for evaluation.
  • implement eval.py.
  • implement darknet loss
  • implement train.py.
  • save as darknet weights
  • support log to tensorboard
  • support multi-gpu training
  • add image preprocess step to boost model accuracy get 0.7303@20171106
  • optimize code in yolo-v2 loss to reduce training time

NOTE: This is still an experimental project. Model trained on VOC0712 train+val

VOC07 test mAP is 0.5630 @20171019

VOC07 test mAp is 0.7303 @20171106
AP for aeroplane = 0.784
AP for bicycle = 0.783
AP for bird = 0.754
AP for boat = 0.648
AP for bottle = 0.481
AP for bus = 0.777
AP for car = 0.824
AP for cat = 0.841
AP for chair = 0.56
AP for cow = 0.772
AP for diningtable = 0.719
AP for dog = 0.79
AP for horse = 0.807
AP for motorbike = 0.784
AP for person = 0.753
AP for pottedplant = 0.53
AP for sheep = 0.765
AP for sofa = 0.708
AP for train = 0.818
AP for tvmonitor = 0.709

Detection Using a Pretrained Model

mkdir weights && cd weights
wget http://pjreddie.com/media/files/yolo-voc.weights
cd ..
./scripts/demo_detect.sh

Training YOLOv2

You can train YOLOv2 on any dataset. Here we train on VOC2007/2012 train+val

  1. Get the PASCAL VOC Data(2007trainval+2012trainval+2007test)
mkdir dataSet && cd dataSet
wget https://pjreddie.com/media/files/VOCtrainval_11-May-2012.tar
wget https://pjreddie.com/media/files/VOCtrainval_06-Nov-2007.tar
wget https://pjreddie.com/media/files/VOCtest_06-Nov-2007.tar
tar xf VOCtrainval_11-May-2012.tar
tar xf VOCtrainval_06-Nov-2007.tar
tar xf VOCtest_06-Nov-2007.tar
cd ..
  1. Generate Labels for VOC
cd dataSet
wget http://pjreddie.com/media/files/voc_label.py
python voc_label.py
cat 2007_train.txt 2007_val.txt 2012_*.txt > voc_train.txt
  1. Modify data/voc.data for Pascal Data
train  = dataSet/train.txt
valid  = dataSet/2007_test.txt
names = data/voc.names
backup = backup
  1. Download Pretrained Convolutional Weights
cd weights
wget http://pjreddie.com/media/files/darknet19_448.conv.23
cd ..
  1. Train The Model
./scripts/demo_train.sh
  1. Evaluate The Model if you want to eval the model, please modify the result directory in demo_eval.sh after running demo_valid
./scripts/demo_valid.sh
./scripts/demo_eval.sh

About

reproduce object detection method such as yolov2, faster rcnn using pytorch

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published