美文网首页
ubuntu18 caffe-gpu安装 anaconda2 o

ubuntu18 caffe-gpu安装 anaconda2 o

作者: Lew_1f22 | 来源:发表于2018-12-30 02:11 被阅读0次

折腾了一下午到凌晨1点多终于把caffe环境安装好了。

电脑型号为戴尔7559,显卡gtx960m,装的双系统。

ubuntu、anaconda2、cuda和cuDNN的安装在好久之前了,这里就不说了。

因为大创项目在网上找了个faster RCNN的代码,环境是caffe,所以就按着要求装了一下。

代码要求是

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 uncommentedWITH_PYTHON_LAYER:= 1#Unrelatedly, it's also recommended that you use CUDNNUSE_CUDNN:= 1

You can see the sample Makefile.config avialable with this repository. It uses conda with GPU support. You need to modify this file to suit your hardware configuration.

Python packages you might not have: cython, python-opencv, easydict

[Optional] MATLAB is required for official PASCAL VOC evaluation only. The code now includes unofficial Python evaluation code.

所以就按着官网的步骤来了

ubuntu指导安装界面中,好像可以直接安装成功,因为我在anaconda激活的环境中输入caffe直接可以使用caffe,但是emmmm因为刚开始学也不知道怎么具体使用,也不是很清楚能不能用,如果有人知道的话欢迎评论和我说一下哈哈,所以还是按着老法子来了。

ubuntu指导界面中的Installing Caffe from source,我使用的是git clone https://github.com/BVLC/caffe.git

然后cd caffe/ 前前后后试了好几次,有一次用cmake差点就成功了,不过我不知道怎么根据自己的要求去“定制”使用cmake,就放弃了。

然后还是乖乖的用make了。

先将gcc g++换成5的版本

多版本共存切换

sudo update-alternatives --config g++

按着提示选择版本

然后安装依赖项

sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev
sudo apt-get install libhdf5-serial-dev protobuf-compiler
sudo apt-get install --no-install-recommends libboost-all-dev
sudo apt-get install libopenblas-dev liblapack-dev libatlas-base-dev
sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev
sudo apt-get install doxygen

添加链接:(我也不清楚啥意思)

cd /usr/lib/x86_64-linux-gnu

lew@lew-Inspiron-7559:/usr/lib/x86_64-linux-gnu$ sudo ln -s libhdf5.so.7 libhdf5.so.9

lew@lew-Inspiron-7559:/usr/lib/x86_64-linux-gnu$ sudo ln -s libhdf5_hl.so.7 libhdf5_hl.so.9

lew@lew-Inspiron-7559:/usr/lib/x86_64-linux-gnu$ sudo ldconfig

修改配置文件

cp Makefile.config.example Makefile.config

sudo gedit Makefile.config

--------------Makefile.config

line5:USE_CUDNN := 1

line23:OPENCV_VERSION := 3

line39:delete two lines 根据型号来

comment line69

line74:PYTHON_INCLUDE := $(ANACONDA_HOME)/include \

  $(ANACONDA_HOME)/include/python2.7 \

  $(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include

comment line84

line85: PYTHON_LIB := $(ANACONDA_HOME)/lib

line95:INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial

LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/hdf5/serial

修改Makefile

--------------Makefile

sudo gedit Makefile

line426:NVCCFLAGS += -D_FORCE_INLINES -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS)

line181:LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_serial_hl hdf5_serial

接下来就是正常步骤了。

参考博客

相关文章

网友评论

      本文标题:ubuntu18 caffe-gpu安装 anaconda2 o

      本文链接:https://www.haomeiwen.com/subject/acvmlqtx.html