您的位置:首页 > 编程语言 > MATLAB

远程服务器 ubuntu16.04 caffe+matlab r2014b+python+cpu-only配置(二)

2018-02-18 16:38 459 查看

配置Caffe+Matlab+Python(CPU-ONLY)

本文参考文章:

ubuntu16.04, Matlab2016b caffe编译安装:https://www.cnblogs.com/haoliuhust/p/7738920.html

官方安装文档:http://caffe.berkeleyvision.org/installation.html

Ubuntu16.04安装Caffe(CPU Only):http://blog.csdn.net/muzilinxi90/article/details/53673184

安装依赖项

$ sudo apt update
$ sudo apt search openblas
$ sudo apt install libopenblas-dev
$ sudo update-alternatives --config libblas.so.3


$ sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-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


此外还要安装git,cmake

$ sudo apt-get install git
$ sudo apt-get install cmake


下载Caffe源码

$ git clone https://github.com/BVLC/caffe.git $ cd caffe/


python 依赖库

$ cd python/
$ apt-get install python-pip
$ pip install --upgrade pip
$ for req in $(cat requirements.txt); do pip install $req; done


编译Caffe

在Caffe文件夹下,拷贝一份Makefile.config.example并重命名成Makefile.config,修改该配置文件:

$ cp Makefile.config.example Makefile.config


打开Makefile.config(vi Makefile.config),因为这里没有配置GPU,所以去掉CPU_ONLY := 1前面的注释,MATLAB_DIR后改为matlab的安装地址

由于Ubuntu16.04文件结构的变化,#Whatever else you find you need goes here.处要改成下面这样:

# Whatever else you find you need goes here.
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/hdf5/serial


注意: 每条路径之间一定要有空格,否则仍然会报错

接下来编译Caffe

$ make all
$ make test
$ make runtest


编译python接口

$ make pycaffe


进入caffe/python,打开python,输入import caffe,如果没有报错则配置成功

编译matlab接口

$ make matcaffe
$ make mattest
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  caffe matlab python