Skip to content
This repository has been archived by the owner on Jul 2, 2021. It is now read-only.

Latest commit

 

History

History

faster_rcnn

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Example codes for Faster R-CNN

Performance

Training Setting Evaluation Original Ours
VOC2007 trainval VOC2007 test 69.9 mAP [1] 70.6 mAP
VOC2007&2012 trainval VOC2007 test 73.2 mAP [1] 74.7 mAP

Speed

ChainerCV and Caffe (py-faster-rcnn) implementations run at almost the same speed. We compared the time it takes to forward an image.

We compared chainercv.links.FasterRCNN.forward and Caffe's equivalent function. We used an image from PASCAL VOC 2007 test split. Our experiment was conducted on Ubuntu 14.04.5 with Pascal Titan X.

Original Ours
15.9 FPS 16.2 FPS

Demo

If a path to pretrained model path is not given, weights distributed on the internet will be used.

$ python demo.py [--gpu <gpu>] [--pretrained-model <model_path>] <image>.jpg

This example will automatically download a pretrained weights from the internet when executed. A sample image to try the implementation can be found in the link below.

https://cloud.githubusercontent.com/assets/2062128/26187667/9cb236da-3bd5-11e7-8bcf-7dbd4302e2dc.jpg

Difference in the runtime behaviour from the original code

The bounding box follows integer bbox convention in the original implementation, whereas the ChainerCV implementation follows float bbox convention used in COCO. The integer convention encodes right below vertex coordinates of bounding boxes by subtracting one from the ground truth, whereas the float convention does not.

On top of that, the anchors are not discretized in ChainerCV.

Train code

For training with VOC2007 (this setting is used by default)

$ python train.py --dataset voc07 --step-size 50000 --iteration 70000 [--gpu <gpu>]

For training with VOC2007+2012

$ python train.py --dataset voc0712 --step-size 80000 --iteration 110000 [--gpu <gpu>]

PlotReport extension uses matplotlib. If you got RuntimeError: Invalid DISPLAY variable error on Linux environment, adding an environment variable specification is recommended:

$ MPLBACKEND=Agg python train.py OPTIONS

Evaluation

The evaluation score is reported by DetectionVOCEvaluator during training. Also, the evaluation can be conducted outside of training loop by using chainercv/examples/detection/eval_detection.py.

References

This code is based on Caffe implementation by the original authors https://github.com/rbgirshick/py-faster-rcnn and Chainer a re-implementation https://github.com/mitmul/chainer-faster-rcnn .

  1. Shaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. "Faster R-CNN: Towards real-time object detection with region proposal networks." In IEEE Transactions on Pattern Analysis and Machine Intelligence, 2016.