深度学习工具-caffe

首先安装caffe,由于我的电脑不是NVIDIA的显卡,所以在ubuntu14.04下安装免去了cuda,使用cpu上执行。
下面介绍在Ubuntu上不带CUDA的Caffe配置编译过程:
1. 安装BLAS: sudoaptgetinstalllibatlasbasedev2. sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libboost-all-dev libhdf5-serial-dev protobuf-compiler liblmdb-dev
3. 安装glog(从http://download.csdn.net/download/chenguangxing3/6661667下载): tarzxvfglog0.3.3.tar.gz, cd glog-0.3.3 , ./configure, make , $ sudo make install
4. 安装gflags(从https://github.com/gflags/gflags下载),依次执行: unzipgflagsmaster.zip, cd gflags-master , mkdirbuild, cd build , exportCXXFLAGS=fPIC, cmake .. , makeVERBOSE=1, make , sudomakeinstall5.lmdb Git clone git://gitorious.org/mdb/mdb.git , cdmdb/libraries/liblmdb, make , sudomakeinstall6.Caffe git clone git://github.com/BVLC/caffe.git
7. 安装Caffe:(1)、 cpMakefile.config.exampleMakefile.config(2)Makefile.config,CPUONLY:=1(3) make all (4)、 maketest(5) make runtest

说明:(1)、如果在第2步中加入了libgflags-dev libgoogle-glog-dev liblmdb-dev 项,则可省去第3、4、5步对glog、gflags、lmdb的单独安装;
         (2)、编译带CUDA支持的Caffe与上面的步骤完全一致,只要把CPU_ONLY:=1注释掉即可。

安装过程中遇到了一个错误分享一下:
Flags from tools/caffe.cpp: -gpu (Run in GPU mode on given device ID.) type: int32 default: -1 -iterations (The number of iterations to run.) type: int32 default: 50 -model (The model definition protocol buffer text file..) type: string default: “” -snapshot (Optional; the snapshot solver state to resume training.) type: string default: “” -solver (The solver definition protocol buffer text file.) type: string default: “” -weights (Optional; the pretrained weights to initialize finetuning. Cannot be set simultaneously with snapshot.) type: string default: “” .build_release/test/test_all.testbin 0 –gtest_shuffle ERROR: something wrong with flag ‘flagfile’ in file ‘/root/glog-0.3.3/gflags-master/src/gflags.cc’. One possibility: file ‘/root/glog-0.3.3/gflags-master/src/gflags.cc’ is being linked both statically and dynamically into this executable. make: * [runtest] Error 1

解决:

1:Promise ourselves failthfully we'll read instructions properly next time around.

2:Uninstall libgflags

sudo apt-get remove -y libgflags

3:Delete make install versions

sudo rm -f /usr/local/lib/libgflags.a /usr/local/lib/libgflags_nothreads.a
sudo rm -rf  /usr/local/include/gflags

4:Clean Caffe build

cd <path>/<to>/caffe
make clean

5:Re-install libgflags package

sudo apt-get install -y libgflags-dev

6:Rebuild Caffe

make all
make test
make runtest

http://stackoverflow.com/questions/30475415/caffe-compilation-error-gflags-cc-is-being-linked-both-statically-and-dynamica
http://blog.csdn.net/fengbingchun/article/details/45535741
http://blog.csdn.net/kkk584520/article/details/52204740

你可能感兴趣的:(ubuntu,深度学习)