A Python3.5/Pytroch implementation of Faster RCNN:Faster R-CNN: Towards Real-Time Object Detection with Region Proposal Networks. And the official implementations are available here. Besides, special thanks for those two repositories:
- python 3.5.x
- pytorch 0.4.1
- tensorboardX
- pillow
- scipy
- numpy
- opencv3
- matplotlib
- easydict
- Train on voc07trainval+voc12trainval
- Test on voc07test
Paper/ResNet101 | This/ResNet101 | This/ResNet50 |
---|---|---|
76.4 | 77.1 | 75.3 |
The training accuracy of rpn and faster_rcnn:
The training loss curves:
- config: define configuration information of Faster RCNN.
- dataset: scripts for creating, downloading, organizing datasets.
- faster_rcnn: neural networks and components that form parts of Faster RCNN.
- utils: tools package, containing some necessary functions.
-
Clone this repository (Faster_RCNN_pytorch):
git clone --recursive https://github.com/Jacqueline121/Faster_RCNN_pytorch.git
-
Install dependencies:
cd Faster_RCNN_pytorch pip install -r requirements.txt
-
Compile roi_pooling and nms:
cd Faster_RCNN_pytorch/faster_rcnn sh make.sh
-
Download the training, validation, test data:
# download 2007 data wget http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCtrainval_06-Nov-2007.tar wget http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCtest_06-Nov-2007.tar wget http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCdevkit_08-Jun-2007.tar # download 2012 data wget http://host.robots.ox.ac.uk/pascal/VOC/voc2012/VOCtrainval_11-May-2012.tar
-
Extract data into one directory named VOCdevkit
# 2007 data tar xvf VOCtrainval_06-Nov-2007.tar tar xvf VOCtest_06-Nov-2007.tar tar xvf VOCdevkit_08-Jun-2007.tar # 2012 data tar xvf VOCtrainval_11-May-2012.tar
-
It should have this basic structure:
$VOCdevkit/ # development kit $VOCdevkit/VOCcode/ # VOC utility code $VOCdevkit/VOC2007 # image sets, annotations, etc. # ... and several other directories ...
-
Create symlinks for the PASCAL VOC dataset:
cd Faster_RCNN_pytorch/dataset mkdir data cd data # 2007 data mkdir VOCdevkit2007 cd VOCdevkit2007 ln -s $VOCdevit/VOC2007 VOC2007 # 2012 data mkdir VOCdevkit2012 cd VOCdevkit2012 ln -s $VOCdevit/VOC2012 VOC2012
cd Faster_RCNN_pytorch/faster_rcnn/backbone
mkdir pretrained
cd pretrained
# resnet50-caffe
wget https://drive.google.com/open?id=0B7fNdx_jAqhtbllXbWxMVEdZclE
# resnet101-caffe
wget https://drive.google.com/open?id=0B7fNdx_jAqhtaXZ4aWppWV96czg
python train.py
python test.py
If you want to visualize the detection result, you can use:
python test.py --vis