最近在做ubuntu16环境下caffe的安装:
caffe官方安装文档:http://caffe.berkeleyvision.org/installation.html
darkknightzh的博客http://www.cnblogs.com/darkknightzh/p/5797526.html
安装caffe之前,建议现安装个Anaconda,caffe支持python2.7和python3.3+建议直接安装Anaconda3。这里有一篇教程怎么安装Anaconda,cuda,cudnn:https://blog.csdn.net/Leona_xz/article/details/89218673
下载caffe:
git clone --recursive https://github.com/BVLC/caffe
安装依赖:
依赖库:protobuf, glog, gflags, hdf5,lmdb。安装:
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
sudo apt-get install libgoogle-glog-dev
sudo apt-get install liblmdb-dev
BLAS可以使用atlas,mkl或者openblas。atlas是caffe默认选择的。mkl和openblas性能更好。安装atlas:
sudo apt-get install libatlas-base-dev
安装caffe时遇到:
这种类似问题一般是找不到安装的库,这个时候需要找到库所在,修改Makefile.config:
-INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include -LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib +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/
2)make: *** [.build_release/tools/upgrade_net_proto_binary.bin] Error 1
.build_release/lib/libcaffe.so: undefined reference to `__cudaPushCallConfiguration'
.build_release/lib/libcaffe.so: undefined reference to `__cudaPopCallConfiguration'
collect2: error: ld returned 1 exit status
应该是cuda版本跟caffe不兼容的问题https://github.com/jwyang/faster-rcnn.pytorch/issues/190,我用的cuda10,degrade cuda版本应该可以,但因为我还在作其他训练,接下来的安装先不做了,等后期安装再更新。