ubuntu 16.04 caffe cpu安装

下载caffe的安装包

git clone git://github.com/BVLC/caffe.git

 

$ cd caffe
$ cp Makefile.config.example Makefile.config (复制一份Makefile.config文件)
$ make pycaffe
$ make all
$ make run
$ make test
测试
$ python
$ import caffe

问题记录

(1)google protobuf 支持2.6

查询 终端输入 protoc --version

libprotoc 2.5.0

最开始安装的3.3 不支,重新安装

(2)make all 出现错误

./include/caffe/util/hdf5.hpp:6:18: fatal error: hdf5.h: No such file or directory

caffe路径下输入

sudo find / -name hdf5.h

找到 find: `/run/user/1000/gvfs': 权限不够
/home/wy/下载/opencv-3.3.0/modules/flann/include/opencv2/flann/hdf5.h
/usr/local/include/opencv2/flann/hdf5.h
/usr/include/opencv2/flann/hdf5.h
/usr/include/hdf5/serial/hdf5.h

在makefile.config文件中

# 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(下个错误要用的)

再执行一遍上述命令,继续报错,这次是/usr/bin/ld: cannot find -lhdf5
于是同上面一个处理 去找libhdf5.so
配置文件改为:

再执行一遍上述命令,继续报错,这次是/usr/bin/ld: cannot find -lhdf5
于是同上面一个处理 去找libhdf5.so
配置文件改:

再执行一遍上述命令,继续报错,这次是/usr/bin/ld: cannot find -lhdf5
于是同上面一个处理 去找libhdf5.so
配置文件改为:

LIBRARY_DIRS := $(PYTHON_LIB) /usr/lib/x86_64-linux-gnu/hdf5/serial \
            /usr/local/lib /usr/lib
  • 1
  • 2
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/include/hdf5/serial \
            /usr/local/include

最终修改的是:

 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

 

每次重新编译:

make clean

make pycaffe

make all

make run

make test

(3)对opencv不支持

 

不保存不用修改
配置Makefile文件(实现对OpenCV3.x的支持)

# Uncomment to use `pkg-config` to specify OpenCV library paths.
# (Usually not necessary -- OpenCV libraries are normally installed in one of the above $LIBRARY_DIRS.)
# USE_PKG_CONFIG := 1
LIBRARIES += opencv_core opencv_highgui opencv_imgproc opencv_imgcodecs

 

还有几个比较好的问题回答

https://github.com/BVLC/caffe/issues/2348#issuecomment-95156848

https://github.com/BVLC/caffe/issues/2092

参考

https://blog.csdn.net/fengbingchun/article/details/72318839

https://blog.csdn.net/weixin_37911283/article/details/70505145

https://blog.csdn.net/zt_1995/article/details/56283249

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值