一、文件架构
二、FSRCNN开发环境搭建:
- 1
- 2
- 3
- 4
- 5
- 1
- 2
- 3
- 4
- 5
- 6
- 7
安装lmdb
cd liblmdb
make
sudo make install
git clone –recursive https://github.com/rbgirshick/fast-rcnn.git
编译:Cython module
cd lib
make
编译:Caffe and pycaffe
cd caffe-fast-rcnn
make -j8 && make pycaffe
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
错误1:
- 1
- 2
- 3
- 4
- 5
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
解决:
~/fast-rcnn/caffe-fast-rcnn/src/caffe/proto$ protoc --cpp_out=/home/hello/fast-rcnn/caffe-fast-rcnn/include/caffe/ caffe.proto
sudo apt-get install libatlas-base-dev
三、训练检测
下载模型文件:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
1、出现问题:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
解决:
sudo apt-get install python-pip
sudo pip install easydict
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
sudo pip install scikit-image
sudo apt-get install python-numpy python-scipy python-matplotlib python-sklearn python-skimage python-h5py python-protobuf python-leveldb python-networkx python-nose python-pandas python-gflags Cython ipython
2、出现问题:
- 1
- 2
- 3
- 4
- 5
- 6
解决:
- 1
- 2
- 3
- 4
- 5
3、出现问题:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
解决:
内存问题
测试结果:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
参考资料:
1、http://blog.youkuaiyun.com/cyh_24/article/details/51440344 卷积神经网络-进化史 从LeNet到AlexNet
2、Accelerating the Super-Resolution Convolutional Neural Network
Chao Dong, Chen Change Loy, and Xiaoou Tang
Department of Information Engineering, The Chinese University of Hong Kong
3、http://www.cnblogs.com/louyihang-loves-baiyan/p/4885659.html FastRCNN 训练自己数据集 (1编译配置)
git clone –recursive https://github.com/rbgirshick/fast-rcnn.git
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
出现问题:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
解决:sudo apt-get install cython
sudo apt-get install protobuf-devel leveldb-devel snappy-devel opencv-devel boost-devel hdf5-devel
4、http://www.w2bc.com/article/125121 目标检测 Faster RCNN算法详解
5、http://www.w2bc.com/article/168733 rcnn fast-rcnn faster-rcnn资料
6、http://www.w2bc.com/article/128354 RCNN学习笔记(7):Faster R-CNN 英文论文翻译笔记
Faster R-CNN: Towards Real-Time Object Detection with Region Proposal Networks
7、http://www.w2bc.com/article/120530 目标检测 Fast RCNN算法详解
8、http://www.w2bc.com/article/136766 faster_rcnn c++版本的 caffe 封装,动态库(2)
9、http://www.cnblogs.com/louyihang-loves-baiyan/p/5485955.html faster_rcnn c++版本的 caffe 封装(1)
10、https://github.com/YihangLou/FasterRCNN-Encapsulation-Cplusplus
11、http://blog.youkuaiyun.com/xyy19920105/article/details/50440957 将Faster RCNN的python demo改成C++ demo
12、http://m.blog.youkuaiyun.com/article/details?id=51036677 目标检测 Fast RCNN算法详解
13、http://jingyan.baidu.com/article/eae07827f7f2d01fec5485f7.html ubuntu 安装python
14、http://www.cnblogs.com/linkboy1980/p/5469994.html CAFFE+FASTERCNN安装记录
15、http://blog.youkuaiyun.com/ture_dream/article/details/52758422 一张图理清CNN脉络 RCNN SPP FASTRCNN FASTERRCNN 到 MSCNN
补充资料:
https://github.com/rbgirshick/fast-rcnn
This code base is no longer maintained and exists as a historical artifact to supplement my ICCV 2015 paper. For more recent work that’s faster and more accurrate, please see Faster R-CNN (which also includes functionality for training Fast R-CNN).
Fast R-CNN: Fast Region-based Convolutional Networks for object detection
Created by Ross Girshick at Microsoft Research, Redmond.
Introduction
Fast R-CNN is a fast framework for object detection with deep ConvNets. Fast R-CNN
trains state-of-the-art models, like VGG16, 9x faster than traditional R-CNN and 3x faster than SPPnet,
runs 200x faster than R-CNN and 10x faster than SPPnet at test-time,
has a significantly higher mAP on PASCAL VOC than both R-CNN and SPPnet,
and is written in Python and C++/Caffe.
Fast R-CNN was initially described in an arXiv tech report and later published at ICCV 2015.
License
Fast R-CNN is released under the MIT License (refer to the LICENSE file for details).
Citing Fast R-CNN
If you find Fast R-CNN useful in your research, please consider citing:
@inproceedings{girshickICCV15fastrcnn,
Author = {Ross Girshick},
Title = {Fast R-CNN},
Booktitle = {International Conference on Computer Vision ({ICCV})},
Year = {2015}
}
Contents
Requirements: software
Requirements: hardware
Basic installation
Demo
Beyond the demo: training and testing
Usage
Extra downloads
Requirements: software
Requirements for Caffe and pycaffe (see: Caffe installation instructions)
Note: Caffe must be built with support for Python layers!
# In your Makefile.config, make sure to have this line uncommented
WITH_PYTHON_LAYER := 1
You can download my Makefile.config for reference.
Python packages you might not have: cython, python-opencv, easydict
[optional] MATLAB (required for PASCAL VOC evaluation only)
Requirements: hardware
For training smaller networks (CaffeNet, VGG_CNN_M_1024) a good GPU (e.g., Titan, K20, K40, ...) with at least 3G of memory suffices
For training with VGG16, you'll need a K40 (~11G of memory)
Installation (sufficient for the demo)
Clone the Fast R-CNN repository
# Make sure to clone with --recursive
git clone --recursive https://github.com/rbgirshick/fast-rcnn.git
We'll call the directory that you cloned Fast R-CNN into FRCN_ROOT
Ignore notes 1 and 2 if you followed step 1 above.
Note 1: If you didn't clone Fast R-CNN with the --recursive flag, then you'll need to manually clone the caffe-fast-rcnn submodule:
git submodule update --init --recursive
Note 2: The caffe-fast-rcnn submodule needs to be on the fast-rcnn branch (or equivalent detached state). This will happen automatically if you follow these instructions.
Build the Cython modules
cd $FRCN_ROOT/lib
make
Build Caffe and pycaffe
cd $FRCN_ROOT/caffe-fast-rcnn
# Now follow the Caffe installation instructions here:
# http://caffe.berkeleyvision.org/installation.html
# If you're experienced with Caffe and have all of the requirements installed
# and your Makefile.config in place, then simply do:
make -j8 && make pycaffe
Download pre-computed Fast R-CNN detectors
cd $FRCN_ROOT
./data/scripts/fetch_fast_rcnn_models.sh
This will populate the $FRCN_ROOT/data folder with fast_rcnn_models. See data/README.md for details.
Demo
After successfully completing basic installation, you’ll be ready to run the demo.
Python
To run the demo
cd $FRCN_ROOT
./tools/demo.py
The demo performs detection using a VGG16 network trained for detection on PASCAL VOC 2007. The object proposals are pre-computed in order to reduce installation requirements.
Note: If the demo crashes Caffe because your GPU doesn’t have enough memory, try running the demo with a small network, e.g., ./tools/demo.py –net caffenet or with –net vgg_cnn_m_1024. Or run in CPU mode ./tools/demo.py –cpu. Type ./tools/demo.py -h for usage.
MATLAB
There’s also a basic MATLAB demo, though it’s missing some minor bells and whistles compared to the Python version.
cd $FRCN_ROOT/matlab
matlab # wait for matlab to start…
At the matlab prompt, run the script:
fast_rcnn_demo
Fast R-CNN training is implemented in Python only, but test-time detection functionality also exists in MATLAB. See matlab/fast_rcnn_demo.m and matlab/fast_rcnn_im_detect.m for details.
Computing object proposals
The demo uses pre-computed selective search proposals computed with this code. If you’d like to compute proposals on your own images, there are many options. Here are some pointers; if you run into trouble using these resources please direct questions to the respective authors.
Selective Search: original matlab code, python wrapper
EdgeBoxes: matlab code
GOP and LPO: python code
MCG: matlab code
RIGOR: matlab code
Apologies if I’ve left your method off this list. Feel free to contact me and ask for it to be included.
Beyond the demo: installation for training and testing models
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
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, annotations, etc.
# ... and several other directories ...
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.
[Optional] follow similar steps to get PASCAL VOC 2010 and 2012
Follow the next sections to download pre-computed object proposals and pre-trained ImageNet models
Download pre-computed Selective Search object proposals
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.
Download pre-trained ImageNet models
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).
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.
Usage
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
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
Experiment scripts
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.
Extra downloads
Experiment logs
PASCAL VOC test set detections
voc_2007_test_results_fast_rcnn_caffenet_trained_on_2007_trainval.tgz
voc_2007_test_results_fast_rcnn_vgg16_trained_on_2007_trainval.tgz
voc_2007_test_results_fast_rcnn_vgg_cnn_m_1024_trained_on_2007_trainval.tgz
voc_2012_test_results_fast_rcnn_vgg16_trained_on_2007_trainvaltest_2012_trainval.tgz
voc_2012_test_results_fast_rcnn_vgg16_trained_on_2012_trainval.tgz
Fast R-CNN VGG16 model trained on VOC07 train,val,test union with VOC12 train,val
本文档详细介绍了Fast R-CNN的安装步骤、环境配置及常见问题解决方案,并提供了模型训练与测试的实战指导。
3013

被折叠的 条评论
为什么被折叠?



