- Notifications
You must be signed in to change notification settings - Fork468
longcw/faster_rcnn_pytorch
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
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 byruotianluoorDetectron.pytorch if you want to train faster rcnn with your own data;
This is aPyTorchimplementation of Faster RCNN.This project is mainly based onpy-faster-rcnnandTFFRCNN.
For details about R-CNN please refer to thepaperFaster R-CNN: Towards Real-Time Object Detection with Region Proposal Networksby Shaoqing Ren, Kaiming He, Ross Girshick, Jian Sun.
- 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
Install the requirements (you can use pip orAnaconda):
conda install pip pyyaml sympy h5py cython numpy scipyconda install -c menpo opencv3pip install easydictClone the Faster R-CNN repository
git clone git@github.com:longcw/faster_rcnn_pytorch.git
Build the Cython modules for nms and the roi_pooling layer
cd faster_rcnn_pytorch/faster_rcnn./make.shDownload the trained modelVGGnet_fast_rcnn_iter_70000.h5 (updated)and set the model path in
demo.pyRun demo
python demo.py
Followthis project (TFFRCNN)to download and prepare the training, validation, test dataand the VGG16 model pre-trained on ImageNet.
Since the program loading the data infaster_rcnn_pytorch/data by default,you can set the data path as following.
cd faster_rcnn_pytorchmkdir datacd dataln -s$VOCdevkit VOCdevkit2007
Then you can set some hyper-parameters intrain.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 infaster_rcnn/faster_rcnn.py by yourself.
With the aid ofCrayon,we can access the visualisation power of TensorBoard for anydeep learning framework.
To use the TensorBoard, install Crayon (https://github.com/torrvision/crayon)and setuse_tensorboard = True infaster_rcnn/train.py.
Set the path of the trained model intest.py.
cd faster_rcnn_pytorchmkdir outputpython test.pyLicense: MIT license (MIT)
About
Faster RCNN with PyTorch
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors3
Uh oh!
There was an error while loading.Please reload this page.