Skip to content

ToDayL/Faster-RCNN_TF

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Faster-RCNN_TF

This is an experimental Tensorflow implementation of Faster RCNN - a convnet for object detection with a region proposal network. For details about R-CNN please refer to the paper Faster R-CNN: Towards Real-Time Object Detection with Region Proposal Networks by Shaoqing Ren, Kaiming He, Ross Girshick, Jian Sun.

The original implementation uses python2 rather than python3. This branch change all code to python3 and make changes to let the code running on Tensorflow 1.4.1. The changes are only tested on VOC 2007 dataset, which runs well. To run code on Coco, maybe more changes should be made. To test on VOC 2007 dataset, just follow the instructions below and enjoy.

The only thing you need to take care is the GPU-arch setting in lib/make.sh. I am using GTX-1080Ti so using -arch=sm_61, choose the parameter depending on your GPU.

Changes made to the original Repo

  1. Update from python2 to python3

  2. Update make script to build cython modules with Tensorflow 1.4.1

  3. Update test module to compatible with ckpt v2 format model

Requirements: software

  1. Requirements for Tensorflow (see: Tensorflow)

  2. Python packages you might not have: cython, python-opencv, easydict

Requirements: hardware

  1. For training the end-to-end version of Faster R-CNN with VGG16, 3G of GPU memory is sufficient (using CUDNN)

Installation (sufficient for the demo)

  1. Clone the Faster R-CNN repository
# Make sure to clone with --recursive
git clone --recursive https://github.com/smallcorgi/Faster-RCNN_TF.git
  1. Build the Cython modules
    cd $FRCN_ROOT/lib
    make

Demo

After successfully completing basic installation, you'll be ready to run the demo.

Download model training on PASCAL VOC 2007 [Google Drive] [Dropbox]

To run the demo

cd $FRCN_ROOT
python ./tools/demo.py --model model_path

The demo performs detection using a VGG16 network trained for detection on PASCAL VOC 2007.

Training Model

  1. Download the training, validation, test data and VOCdevkit

    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
  2. Extract all of these tars into one directory named VOCdevkit

    tar xvf VOCtrainval_06-Nov-2007.tar
    tar xvf VOCtest_06-Nov-2007.tar
    tar xvf VOCdevkit_08-Jun-2007.tar
  3. It should have this basic structure

    $VOCdevkit/                           # development kit
    $VOCdevkit/VOCcode/                   # VOC utility code
    $VOCdevkit/VOC2007                    # image sets, annotations, etc.
    # ... and several other directories ...
  4. Create symlinks for the PASCAL VOC dataset

    cd $FRCN_ROOT/data
    ln -s $VOCdevkit VOCdevkit2007
  5. Download pre-trained ImageNet models

    Download the pre-trained ImageNet models [Google Drive] [Dropbox]

    mv VGG_imagenet.npy $FRCN_ROOT/data/pretrain_model/VGG_imagenet.npy
  6. Run script to train and test model

    cd $FRCN_ROOT
    ./experiments/scripts/faster_rcnn_end2end.sh $DEVICE $DEVICE_ID VGG16 pascal_voc

DEVICE is either cpu/gpu

The result of testing on PASCAL VOC 2007

Classes AP
aeroplane 0.698
bicycle 0.788
bird 0.657
boat 0.565
bottle 0.478
bus 0.762
car 0.797
cat 0.793
chair 0.479
cow 0.724
diningtable 0.648
dog 0.803
horse 0.797
motorbike 0.732
person 0.770
pottedplant 0.384
sheep 0.664
sofa 0.650
train 0.766
tvmonitor 0.666
mAP 0.681

My Result with 200000 iters:

Classes AP
aeroplane 0.692
bicycle 0.778
bird 0.646
boat 0.595
bottle 0.535
bus 0.804
car 0.799
cat 0.797
chair 0.507
cow 0.732
diningtable 0.632
dog 0.763
horse 0.805
motorbike 0.775
person 0.770
pottedplant 0.403
sheep 0.664
sofa 0.663
train 0.757
tvmonitor 0.701
mAP 0.691

###References Faster R-CNN caffe version

A tensorflow implementation of SubCNN (working progress)

Thanks

Thanks to @lev-kusanagi's solution on using ckpt v2 format model

Thanks to @awilliamson's solution on building cython modules

About

Faster-RCNN in Tensorflow with python3

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 90.9%
  • C++ 7.3%
  • Cuda 1.1%
  • Other 0.7%