caffe配置中的一些问题
一直想將DL用于自己目前研究的image retrieval中,實(shí)際上,本小子在之前的博文Deep Learning for Content-Based Image Retrieval關(guān)于用DL做檢索的paper也做了些調(diào)研。可以看出,雖然DL現(xiàn)在很火,但是將其用于image retrieval似乎還并不多。這連天正好忙里偷閑,在Ubuntu12.04中把caffe搗鼓了一番,成功,只能說(shuō)配置起來(lái)真的很egg pain。下面是自己在配置過(guò)程中出現(xiàn)的一些問題,配置的時(shí)候自己特地做了筆記,便于后面查閱。
1、 CUDA自帶了顯卡驅(qū)動(dòng),安裝后圖形界面分辨率變模糊,NVIDIA圖形配置是出現(xiàn):
You do not appear to be using the NVIDIA X driver. Please edit your X configuration file (just run nvidia-xconfig as root), and restart the X server主要是由于沒激活安裝的顯卡:
I was also facing the same problem. Now that you asked it, I wanted to fix >in my computer as well. So here is how you do it.
EDIT: sudo apt-get install nvidia-current
sudo nvidia-xconfig. This will just create the file /etc/X11/xorg.conf. Next do
sudo software-properties-gtk
答案鏈接按照上面安裝后,重啟,完成激活。
2、/include/caffe/common.hpp:5:27: 致命錯(cuò)誤: gflags/gflags.h:沒有那個(gè)文件或目錄編譯中斷。make: *** [.build_release/src/caffe/common.o] 錯(cuò)誤。可以看出跟gflags有關(guān),大概推測(cè)是gflags沒裝,于是按照教程把下面的都安裝了:
# 安裝glog/gflags/lmdb # glog wget https://google-glog.googlecode.com/files/glog-0.3.3.tar.gz tar zxvf glog-0.3.3.tar.gz cd glog-0.3.3 ./configure make && make install # gflags wget https://github.com/schuhschuh/gflags/archive/master.zip unzip master.zip cd gflags-master mkdir build && cd build export CXXFLAGS="-fPIC" && cmake .. && make VERBOSE=1 make && make install # lmdb git clone https://gitorious.org//mdb/mdb.git cd mdb/libraries/liblmdb make && make install3、如果用make all編譯caffe時(shí)出現(xiàn)mkl錯(cuò)誤:./include/caffe/util/mkl_alternate.hpp:6:17: 致命錯(cuò)誤: mkl.h:沒有那個(gè)文件或目錄 編譯中斷。主要是因?yàn)镸KL與CUDA的環(huán)境設(shè)置沒設(shè)置好。另外安裝MKL時(shí)最好選擇默認(rèn)路徑:
/opt/intel/lib/intel64 /opt/intel/mkl/lib/intel644、出現(xiàn):/usr/bin/ld: cannot find -lboost_system collect2: ld 返回 1make: *** [.build_release/lib/libcaffe.so] 錯(cuò)誤。這個(gè)需要安裝libboost-dev,運(yùn)行下面命令即可完成按照:
sudo apt-get install libboost-all-dev安裝Caffe并測(cè)試。切換到Caffe的下載文件夾,然后執(zhí)行:
$ cp Makefile.config.example Makefile.config修改新生成的Makefile.config文件,修改“BLAS := mkl”,這個(gè)非常重要。
$ make clean $ make all $ make test $ make runtest新建cuda.conf,并編輯之:
$ sudo touch cuda.conf $ sudo vim cuda.conf在新建的cuda.conf中添加:
/usr/local/cuda/lib64 /lib完成lib文件的鏈接操作,執(zhí)行:
$ sudo ldconfig -v5、When ./create_mnist.sh, fault: convert_mnist_data.bin: not found
這個(gè)問題,在caffe github上有人提出了issue,鏈接傳送門,按照答案說(shuō)的,對(duì)于caffe,必須得在caffe的根目錄,所以根目錄運(yùn)行腳本吧。
最后,如果沒用GPU的話,在examples/mnist/lenet_solver.prototxt最后一行修改GPU為CPU。
caffe python接口安裝
1、 如果沒有pip的話,先安裝pip。進(jìn)入caffe python目錄,安裝所需要的依賴關(guān)系:
sudo pip install -r requirement.txt用requirements.txt失敗,用 Anaconda安裝sudo pip install -r /path/to/caffe/python/requirements.txt在執(zhí)行上述命令時(shí), 會(huì)報(bào)錯(cuò)導(dǎo)致不能完全安裝所有需要的包。 可以按照官方建議安裝anaconda包。 在anaconda官網(wǎng)下載.sh文件,執(zhí)行,最后添加bin目錄到環(huán)境變量即可(在安裝的時(shí)候會(huì)詢問你時(shí)是否添加)。
注意:Anaconda安裝的庫(kù)并沒有在python的庫(kù)目錄中。
2、 錯(cuò)誤:libm.so.6: GLIBC_2.15 not found, required by libopencv。。。將libm.so.6和libm.so重命名為別的即可,比如:
sudo mv libm.so.6 libm.so.6.backup sudo mv libm.so libm.so.backup3、 你需要安裝ipython和ipython qtconsole。安裝完后可以用下面的腳本測(cè)試:
import sys sys.path.append('/home/yong/anaconda/lib/python2.7/site-packages') sys.path.append('/usr/lib/python2.7/dist-packages')import numpy as np import matplotlib.pyplot as plt %matplotlib inline# Make sure that caffe is on the python path: caffe_root = '../' # this file is expected to be in {caffe_root}/examplessys.path.insert(0, caffe_root + 'python')import caffeplt.rcParams['figure.figsize'] = (10, 10) plt.rcParams['image.interpolation'] = 'nearest' plt.rcParams['image.cmap'] = 'gray'參考:
caffe官網(wǎng)
Ubuntu12.04上面用CPU編譯使用caffe(不完全安裝)
Caffe + Ubuntu 14.04 + CUDA 6.5 新手安裝配置指南
Caffe配置過(guò)程
DIY Deep Learning for Vision: a Hands-On Tutorial with Caffe
總結(jié)
以上是生活随笔為你收集整理的caffe配置中的一些问题的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: OpenCV行人检测
- 下一篇: VLAD教程和资料 All about