Caffe的安装与测试

推荐系统与硬件组合:Ubuntu14.04+cuda 7.5

1、安装cuda

安装caffe:Git clone https://github.com/BVLC/caffe

安装caffe依赖包:http://caffe.berkeleyvision.org/

->Installation instructions

->Ubuntu installation

->sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-devlibopencv-dev libhdf5-serial-dev protobuf-compiler

->sudo apt-get install --no-install-recommends libboost-all-dev

->sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev

2、安装python依赖包

Cython>=0.19.2

numpy>=1.7.1

scipy>=0.13.2

scikit-image>=0.9.3

matplotlib>=1.3.1

ipython>=3.0.0

h5py>=2.2.0

leveldb>=0.191

networkx>=1.8.1

nose>=1.3.0

pandas>=0.12.0

python-dateutil>=1.4,<2

protobuf>=2.5.0

python-gflags>=2.0

pyyaml>=3.10

Pillow>=2.3.0

six>=1.1.0

 

Cd caffeàless python/requirements.txt

Sudo apt-getinstall …各依赖包

Eg: sudo apt-getinstall cython python-numpy python-scipy python-scikits-learn python-matplotlibipython python-h5py python-leveldb python-networkx python-nose python-pandaspython-dateutil python-protobuf python-gflags python-yaml python-six

Makefile配置文件的配置

1、复制Caffe文件夹下的Makefile的配置文件Makefile.config-example:cp Makefile.config-exampleMakefile.config

>>vimMakefile.config对该文件进行配置修改

USE_LEVELDB

USE_LMDB       此两个是caffe的训练知识,因为caffe的训练数据需要从数据库里读出来,此数据库由LEVELDB和LMDB来做。

>>make或make -j*(表示有几个线程在编译caffe,这样比较快)

2、进行~/caffe/build文件夹用cmake进行编译即输入>>cmake..  (失败修改vim ../cmake/Dependencies.cmake后需要rm CMakeCache.txt,再重新cmake ..)

>>make或make -j*(表示有几个线程在编译caffe,这样比较快)

3、测试

./build/examples/cpp_classification/classification.bin

models/bvlc_reference_caffenet/deploy.prototxt              //模型网络结构的定义

models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel         //网络中的权值

data/ilsvrc12/imagenet_mean.binaryproto           //图像预处理,图像去均值化(归一化)

data/ilsvrc12/synset_words.txt              //每个类的类名

examples/images/cat.jpg           //输入图像

你可能感兴趣的:(caffe)