Skip to content

kobewangSky/easy-faster-rcnn.pytorch

 
 

Repository files navigation

easy-faster-rcnn.pytorch

An easy implementation of Faster R-CNN in PyTorch.

Demo

Results

VOC 2007

Model Training Speed Inference Speed mAP
VGG-16 ~7 examples/sec ~13 examples/sec 0.7015
ResNet-101 (freeze 0~4) ~5.4 examples/sec ~11 examples/sec 0.7496
ResNet-101 (freeze 0~5) ~5.7 examples/sec ~11 examples/sec 0.7466
ResNet-101 (freeze 0~6) ~7.5 examples/sec ~11 examples/sec 0.7523
ResNet-101 (freeze 0~7) ~8.4 examples/sec ~11 examples/sec 0.6983

All the experiments above are running on GTX-1080-Ti

Requirements

  • Python 3.6

  • torch 0.4.1

  • torchvision 0.2.1

  • tqdm

    $ pip install tqdm
    

Setup

  1. Download VOC 2007 Dataset

  2. Extract to data folder, now your folder structure should be like:

    easy-faster-rcnn.pytorch
        - data
            - VOCdevkit
                - VOC2007
                    - Annotations
                        - 000001.xml
                        - 000002.xml
                        ...
                    - ImageSets
                        - Main
                            ...
                            test.txt
                            ...
                            trainval.txt
                            ...
                    - JPEGImages
                        - 000001.jpg
                        - 000002.jpg
                        ...
    
  3. Build non-maximum-suppression module

    $ nvcc -arch=sm_61 -c --compiler-options -fPIC -o nms/src/nms_cuda.o nms/src/nms_cuda.cu
    $ python nms/build.py
    $ python -m nms.test.test_nms
    

    sm_61 is for GTX-1080-Ti, to see others visit here

    • Result after unit testing

    • Illustration for NMS CUDA

    • Unit test failed? Try to:

      • rebuild module

      • check your GPU architecture, you might need following script to find out GPU information

        $ nvidia-smi -L
        

Usage

  1. Train

    $ python train.py -b=vgg16 -d=./data -c=./checkpoints
    
  2. Evaluate

    $ python eval.py ./checkpoints/model-100.pth -b=vgg16 -d=./data -r=./results
    
  3. Clean

    $ rm -rf ./checkpoints
    $ rm -rf ./results
    
  4. Infer

    $ python infer.py input-image.jpg output-image.jpg -c=./checkpoints/model-100.pth -b=vgg16
    

About

An easy implementation of Faster R-CNN in PyTorch.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 92.0%
  • Cuda 6.1%
  • C 1.9%