深度學習工具-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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章