- Requirements for Caffe and pycaffe
- Additional Python packages: cython, python-opencv, easydict
- Matlab (required for PASCAL VOC evaluation only)
- Extract the source code:
$ tar zxvf fast-rcnn.tgz
; call the source directory $FRCNN - Build Cython modules:
$ cd $FRCNN/src && make
(there will probably be some benign warnings that you can ignore) - Build Caffe and pycaffe:
$ cd $FRCNN/caffe-fast-rcnn
and follow the Caffe installation instructions - Establish symlinks for VOCdevkits
- Symlink
$FRCNN/data/VOCdevkit2007
to where you have the PASCAL VOC 2007 devkit and data installed - And similiarly for other PASCAL VOC 20XY datasets
- Symlink
$FRCNN/data/cache
to somewhere that will store cached dataset files
Train a Fast R-CNN detector. For example, train a VGG 16 network on VOC 2007 trainval:
./tools/train_net.py --gpu 0 --solver models/VGG_16/solver.prototxt --weights /data/reference_caffe_nets/VGG_ILSVRC_16_layers.v2.caffemodel
Test a Fast R-CNN detector. For example, test the VGG 16 network on VOC 2007 test:
./tools/test_net.py --gpu 1 --def models/VGG_16/test.prototxt --net snapshots/vgg16_fast_rcnn_iter_40000.caffemodel
Test output is written underneath $FRCNN/output
.
Compress a Fast R-CNN model using SVD on the fully-connected layers:
./tools/compress_model.py --def models/VGG_16/test.prototxt --def-svd models/VGG_16/compressed/test.prototxt --net snapshots/vgg16_fast_rcnn_iter_40000.caffemodel