caffe
caffe-凯发ag旗舰厅登录网址下载
转载请注明:http://blog.csdn.net/forest_world
一、文件架构
二、fsrcnn开发环境搭建:
faster-rcnn: matlab版本shaoqingren/faster_rcnn: faster r-cnn rbg提供的python版本rbgirshick/py-faster-rcnn- 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:
ld -o .build_release/lib/libcaffe.so .build_release/src/caffe/layers/absval_layer.o: file not recognized: file truncated collect2: error: ld returned 1 exit status make: *** [.build_release/lib/libcaffe.so] error 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
三、训练检测
下载模型文件:
@ubuntu:~/fast-rcnn$ ./data/scripts/fetch_fast_rcnn_models.sh downloading fast r-cnn demo models (0.96g)... --2016-11-08 11:01:15-- http://www.cs.berkeley.edu/~rbg/fast-rcnn-data/fast_rcnn_models.tgz resolving www.cs.berkeley.edu (www.cs.berkeley.edu)... 23.253.180.102 connecting to www.cs.berkeley.edu (www.cs.berkeley.edu)|23.253.180.102|:80... connected. http request sent, awaiting response... 302 found location: http://101.96.10.61/www.cs.berkeley.edu/~rbg/fast-rcnn-data/fast_rcnn_models.tgz [following] --2016-11-08 11:01:16-- http://101.96.10.61/www.cs.berkeley.edu/~rbg/fast-rcnn-data/fast_rcnn_models.tgz connecting to 101.96.10.61:80... connected. http request sent, awaiting response... 303 see other location: https://people.eecs.berkeley.edu/~rbg/fast-rcnn-data/fast_rcnn_models.tgz [following]- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
1、出现问题:
~/fast-rcnn/tools$ ./demo.py traceback (most recent call last):file "./demo.py", line 17, in <module>from fast_rcnn.config import cfgfile "/home//fast-rcnn/tools/../lib/fast_rcnn/__init__.py", line 8, in <module>from . import configfile "/home//fast-rcnn/tools/../lib/fast_rcnn/config.py", line 23, in <module>from easydict import easydict as edict importerror: no module named easydict- 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、出现问题:
@ubuntu:~/fast-rcnn/tools$ ./demo.py warning: logging before initgooglelogging() is written to stderr f1108 15:18:01.710467 13445 common.cpp:55] cannot use gpu in cpu-only caffe: check mode. *** check failure stack trace: *** aborted (core dumped)- 1
- 2
- 3
- 4
- 5
- 6
解决:
#if args.cpu_mode:caffe.set_mode_cpu()#else:#caffe.set_mode_gpu()#caffe.set_device(args.gpu_id)- 1
- 2
- 3
- 4
- 5
3、出现问题:
libprotobuf warning google/protobuf/io/coded_stream.cc:505] reading dangerously large protocol message. if the message turns out to be larger than 2147483647 bytes, parsing will be halted for security reasons. to increase the limit (or to disable these warnings), see codedinputstream::settotalbyteslimit() in google/protobuf/io/coded_stream.h. [libprotobuf warning google/protobuf/io/coded_stream.cc:78] the total number of bytes read was 538766130loaded network /home//fast-rcnn/data/fast_rcnn_models/vgg16_fast_rcnn_iter_40000.caffemodel ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ demo for data/demo/000004.jpg f1108 15:28:31.449816 13520 syncedmem.hpp:27] check failed: *ptr host allocation of size 255744000 failed *** check failure stack trace: *** aborted (core dumped)- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
解决:
内存问题
测试结果:
loaded network /home//fast-rcnn/data/fast_rcnn_models/vgg16_fast_rcnn_iter_40000.caffemodel ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ demo for data/demo/000004.jpg detection took 56.309s for 2888 object proposals all car detections with p(car | box) >= 0.8 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ demo for data/demo/001551.jpg detection took 40.754s for 2057 object proposals all sofa detections with p(sofa | box) >= 0.8 all tvmonitor detections with p(tvmonitor | box) >= 0.8- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
参考资料:
1、http://blog.csdn.net/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
出现问题:
@ubuntu:~/fast-rcnn/lib$ make python setup.py build_ext --inplace traceback (most recent call last):file "setup.py", line 11, in <module>from cython.distutils import build_ext importerror: no module named cython.distutils make: *** [all] error 1- 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.csdn.net/xyy19920105/article/details/50440957 将faster rcnn的python demo改成c demo
12、http://m.blog.csdn.net/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.csdn.net/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 downloadsrequirements: 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 := 1you 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.gitwe'll call the directory that you cloned fast r-cnn into frcn_rootignore 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 --recursivenote 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 modulescd $frcn_root/lib makebuild caffe and pycaffecd $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 pycaffedownload pre-computed fast r-cnn detectorscd $frcn_root ./data/scripts/fetch_fast_rcnn_models.shthis 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…
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 codeapologies 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 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
./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
本文地址:http://blog.csdn.net/forest_world
与50位技术专家面对面20年技术见证,附赠技术全景图总结
以上是凯发ag旗舰厅登录网址下载为你收集整理的caffe-fast-rcnn(caffe、fsrcnn、fastrcnn)的全部内容,希望文章能够帮你解决所遇到的问题。
如果觉得凯发ag旗舰厅登录网址下载网站内容还不错,欢迎将凯发ag旗舰厅登录网址下载推荐给好友。
- 上一篇:
- 下一篇: 如何用深度学习进行ct影像肺结节探测(附