This repo is an implementation of Faster R-CNN integrating both Keras and Tensorflow. We use a lot of endernewton‘s tensorflow code, and the reference is that: https://github.com/endernewton/tf-faster-rcnn
Our implementation is aiming to build the Keras interface based on a Tensorflow Faster R-CNN code [1]. Most of the tensorflow functions are packed by using Keras Lambda function. We reconstruct the code based on the above goals.
model | #GPUs | batch size | lr | max_epoch | mem/GPU | mAP (%) |
---|---|---|---|---|---|---|
VGG-16 | 1 | 1 | 1e-5 | 7 | 8817 MB | 66.0 |
model | #GPUs | batch size | lr | max_epoch | mem/GPU | mAP (%) |
---|---|---|---|---|---|---|
VGG-16 | 1 | 1 | 1e-5 | 7 | 8817 MB | 72.2 |
model | #GPUs | batch size | lr | max_epoch | mem/GPU | mAP (%) |
---|---|---|---|---|---|---|
VGG-16 | 1 | 1 | 1e-5 | 7 | 8817 MB | 31.2 |
-
Ubuntu 16.04
-
Python 2/3, in case you need the sufficient scientific computing packages, we recommend you to install anaconda.
-
Tensorflow >= 1.5.0
-
Keras >= 2.2.0
-
Optional: if you need GPUs acceleration, please install CUDA that the version requires >= 9.0
-
Follow the ref: https://github.com/rbgirshick/py-faster-rcnn#beyond-the-demo-installation-for-training-and-testing-models. Download Pascal VOC 07 dataset and build soft link in folder ./data/, then name the link as "VOCdevkit2007"
To compile the lib, move into the lib folder "cd ./lib". According to your hardware, change the "-arch" parameter in setup.py line: 130. Then run
make
Tips: to find your hardware compiling setting, you can refer to: http://arnon.dk/matching-sm-architectures-arch-and-gencode-for-various-nvidia-cards/. For me using the Titan XP, I set the "-arch" as "sm_61".
-
Build the model weight saving folder "../output/[NET]/"
Download pre-trained models and weights:
mkdir net_weights wget https://github.com/fchollet/deep-learning-models/releases/download/v0.1/vgg16_weights_tf_dim_ordering_tf_kernels.h5 cd ..
Run the following script:
./scripts/train_faster_rcnn.sh [GPU_ID] [DATASET] [NET] # GPU_ID is the GPU you want to test on # NET in {vgg16} is the network arch to use, # DATASET {pascal_voc, pascal_voc_0712, coco} is defined in train_faster_rcnn.sh # Examples: ./scripts/train_faster_rcnn.sh 0 pascal_voc vgg16
-
Build the test output saving folder "../output/[NET]/"
Run the following script:
./scripts/test_faster_rcnn.sh [GPU_ID] [DATASET] [NET] # GPU_ID is the GPU you want to test on # NET in {vgg16} is the network arch to use, # DATASET {pascal_voc, pascal_voc_0712, coco} is defined in train_faster_rcnn.sh # Examples: ./scripts/test_faster_rcnn.sh 0 pascal_voc vgg16
- [1] tf-faster-rcnn: https://github.com/endernewton/tf-faster-rcnn