如何在 centos 7.3 上安装 caffe 深度学习工具


 有好多朋友在安装 caffe 时遇到不少问题。(看文章的朋友希望关心一下我的创业项目趣智思成) 今天测试并整理一下安装过程。我是在阿里云上测试,选择centos 7.3 镜像。

先安装 epel 源

yum install epel-release

安装基本编译环境

yum install protobuf-devel leveldb-devel snappy-devel opencv-devel boost-devel hdf5-devel
yum install gflags-devel glog-devel lmdb-devel
yum install atlas-devel
#用默认的 atlas 有点问题,需要改为 openblas
yum install openblas-devel
yum install python34-devel yum install git yum groupinstall "Development Tools" "Development Libraries"

下载源代码

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

到源代码目录下执行

mv Makefile.config.example Makefile.config

修改配置文件 Makefile.config
所有不是#开头的都需要修改

# CPU-only switch (uncomment to build without GPU support).
CPU_ONLY := 1

# BLAS choice:
# atlas for ATLAS (default)
# mkl for MKL
# open for OpenBlas
BLAS := open   
# Custom (MKL/ATLAS/OpenBLAS) include and lib directories.
# Leave commented to accept the defaults for your choice of BLAS
# (which should work)!
# BLAS_INCLUDE := /path/to/your/blas
#BLAS_LIB := /path/to/your/blas
BLAS_INCLUDE := /usr/include/openblas
BLAS_LIB := /usr/lib64

最后在 caffe 目录下运行:build。就完成了。有任何问题欢迎发在评论区。