标签(空格分隔):vision
Download the training, validation, test data and VOCdevkit
wget http://pascallin.ecs.soton.ac.uk/challenges/VOC/voc2007/VOCtrainval_06-Nov-2007.tar
wget http://pascallin.ecs.soton.ac.uk/challenges/VOC/voc2007/VOCtest_06-Nov-2007.tar
wget http://pascallin.ecs.soton.ac.uk/challenges/VOC/voc2007/VOCdevkit_08-Jun-2007.tar
没法下载,只能从其他地方下下来,然后传到Ubuntu机器上。
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
It should have this basic structure
$VOCdevkit/ # development kit
$VOCdevkit/VOCcode/ # VOC utility code
$VOCdevkit/VOC2007 # image sets,anotation
# ... and several other directories ...
VOCdevkit/VOCcode/
这个目录我为什么没有?
Create symlinks for the PASCAL VOC dataset
cd $FRCN_ROOT/data
ln -s $VOCdevkit VOCdevkit2007
Using symlinks is a good idea because you will likely want to share the same PASCAL dataset installation between multiple projects. 创建一个Symbolic (还是叫Soft) link是一个好的习惯。
[Optional] follow similar steps to get PASCAL VOC 2010 and 2012 (下载不了)
Pre-computed selective search boxes can also be downloaded for VOC2007 and VOC2012.
cd $FRCN_ROOT
./data/scripts/fetch_selective_search_data.sh
This will populate the $FRCN_ROOT/data
folder with selective_selective_data
.
在这个目录中有如下一些Matlab的数据文件,很容易看出这些文件应该包含何种的内容,应该就是在各个图像上运行Selective Search得到的Roi Proposals。
voc_2007_test.mat voc_2007_val.mat voc_2012_trainval.mat
voc_2007_train.mat voc_2012_test.mat voc_2012_val.mat
voc_2007_trainval.mat voc_2012_train.mat
Pre-trained ImageNet models can be downloaded for the three networks described in the paper: CaffeNet (model S), VGG_CNN_M_1024 (model M), and VGG16 (model L).
FR-CNN的输入有两个:一个是在ImageNet上训练的多层CNN的输出,另一个就是上面的Selective Search得到的Roi Proposals。所以这里把训练好的多层CNN下载下来(FR-CNN的Fine tune也不会修改这个层次的网络?)。
cd $FRCN_ROOT
./data/scripts/fetch_imagenet_models.sh
These models are all available in the Caffe Model Zoo, but are provided here for your convenience.
ls data/imagenet_models
CaffeNet.v2.caffemodel (最小)
VGG16.v2.caffemodel (最大)
VGG_CNN_M_1024.v2.caffemodel (中等)
Train a Fast R-CNN detector. For example, train a VGG16 network on VOC 2007 trainval:
./tools/train_net.py --gpu 0 --solver models/VGG16/solver.prototxt \
--weights data/imagenet_models/VGG16.v2.caffemodel
只是在CPU上试试,所以不能用上面的命令。改成:
./tools/train_net.py --cpu --solver models/CaffeNet/solver.prototxt --weights data/imagenet_models/CaffeNet.v2.caffemodel
If you see this error
EnvironmentError: MATLAB command 'matlab' not found. Please add 'matlab' to your PATH.
then you need to make sure the matlab
binary is in your $PATH
. MATLAB is currently required for PASCAL VOC evaluation.
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/VGG16/test.prototxt \
--net output/default/voc_2007_trainval/vgg16_fast_rcnn_iter_40000.caffemodel
Test output is written underneath $FRCN_ROOT/output
.
Compress a Fast R-CNN model using truncated SVD on the fully-connected layers:
./tools/compress_net.py --def models/VGG16/test.prototxt \
--def-svd models/VGG16/compressed/test.prototxt \
--net output/default/voc_2007_trainval/vgg16_fast_rcnn_iter_40000.caffemodel
# Test the model you just compressed
./tools/test_net.py --gpu 0 --def models/VGG16/compressed/test.prototxt \
--net output/default/voc_2007_trainval/vgg16_fast_rcnn_iter_40000_svd_fc6_1024_fc7_256.caffemodel
Scripts to reproduce the experiments in the paper (up to stochastic variation) are provided in $FRCN_ROOT/experiments/scripts
. Log files for experiments are located in experiments/logs
.
Note: Until recently (commit a566e39), the RNG seed for Caffe was not fixed during training. Now it’s fixed, unless train_net.py
is called with the --rand
flag.
Results generated before this commit will have some stochastic variation.