配置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
安装依赖项
1 | $ sudo apt update |
1 | $ sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler |
1 | $ sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev |
此外还要安装git,cmake
1 | $ sudo apt-get install git |
下载Caffe源码
1 | $ git clone https://github.com/BVLC/caffe.git |
python 依赖库
1 | $ cd python/ |
编译Caffe
在Caffe文件夹下,拷贝一份Makefile.config.example并重命名成Makefile.config,修改该配置文件:
1 | $ 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.处要改成下面这样:
1 | # Whatever else you find you need goes here. |
注意: 每条路径之间一定要有空格,否则仍然会报错
接下来编译Caffe
1 | $ make all |
编译python接口
1 | $ make pycaffe |
进入caffe/python,打开python,输入import caffe,如果没有报错则配置成功
编译matlab接口
1 | $ make matcaffe |