Note: I re-implemented faster rcnn in this project
when I started learning PyTorch. Then I use PyTorch in all of my
projects. I still remember it costed one week for me to figure out how
to build cuda code as a pytorch layer :).
But actually this is not a good implementation and I didn't achieve the
same mAP as the original caffe code.
This project is no longer maintained and may not compatible with the newest pytorch (after 0.4.0). So I suggest:
You can still read and study this code if you want to re-implement faster rcnn by yourself;
You can use the better PyTorch implementation by ruotianluoor Detectron.pytorch if you want to train faster rcnn with your own data;
For details about R-CNN please refer to the paperFaster R-CNN: Towards Real-Time Object Detection with Region Proposal Networks
by Shaoqing Ren, Kaiming He, Ross Girshick, Jian Sun.
Progress
Forward for detecting
RoI Pooling layer with C extensions on CPU (only forward)
RoI Pooling layer on GPU (forward and backward)
Training on VOC2007
TensroBoard support
Evaluation
Installation and demo
Install the requirements (you can use pip or Anaconda):
Follow this project (TFFRCNN)to download and prepare the training, validation, test data
and the VGG16 model pre-trained on ImageNet.
Since the program loading the data in faster_rcnn_pytorch/data by default,
you can set the data path as following.
cd faster_rcnn_pytorch
mkdir datacd data
ln -s $VOCdevkit VOCdevkit2007
Then you can set some hyper-parameters in train.py and training parameters in the .yml file.
Now I got a 0.661 mAP on VOC07 while the origin paper got a 0.699 mAP.
You may need to tune the loss function defined in faster_rcnn/faster_rcnn.py by yourself.
Training with TensorBoard
With the aid of Crayon,
we can access the visualisation power of TensorBoard for any
deep learning framework.