您的位置:首页 > Web前端

Ubuntu14.02(64位系统)+caffe环境配置

2015-12-11 18:27 731 查看
不好意思,由于一些原因,那个博客丢失了。这里保证是作者原创。并且验证成功地。所以重新开一个,Ubuntu的caffe配置。这里选择的是Ubuntu系统,64位,建议不要选择选择32位系统。不然会出现错误。

1.首先安装一些基本的依赖:

sudo apt-get install build-essentials

在这里可能或出现error,出现不能更新的情况,这里打开setting,然后找到System software and update 然后选择合适的服务器,我这里选择的是tsing.edu.cn(一般选择之后,就会成功,如果还是不可以,自己检测合适的服务器)。

2.安装其他依赖库:

Sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-devlibhdf5-serial-dev protobuf-compiler

在这里如果出现有些不可以安装的情况,可以单个进行安装例如 sudo apt-get install libprotobuf-dev.这里主要看的是官网。如果是Ubantu14.04.在进行结束后可以执行

sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev


如果是12.02,那么需要进行

# glog

wget https://google-glog.googlecode.com/files/glog-0.3.3.tar.gz[/code] 
tar zxvf glog-0.3.3.tar.gz

cd glog-0.3.3

./configure

make && make install

# gflags

wget https://github.com/schuhschuh/gflags/archive/master.zip[/code] 
unzip master.zip

cd gflags-master

mkdir build && cd build

export CXXFLAGS="-fPIC" && cmake .. && make VERBOSE=1

make && make install

# lmdb

git clone https://github.com/LMDB/lmdb[/code] 
cd lmdb/libraries/liblmdb

make && make install


这里建议,在安装库是,都在根目录下进行,我的是/home/caffe

3.安装ATLAS for Ubuntu(或者OPENBLAS)

如果想要安装atlas可以通过简单的运行指令:

sudo apt-get install libatlas-base-dev(这里亲测可以通录过)

我在这里安装的是openblas,这里会比较麻烦一点。(根目下执行)

首先下载libblas-common_1.2.20110419-10_amd64.deb,libopenblas-base_0.2.12-1ubuntu1_amd64.deb,libopenblas-dev_0.2.12-1ubuntu1_amd64.deb,通过命令

sudo dpkg -i libblas-common_1.2.20110419-10_amd64.deb,libopenblas-base_0.2.12-1ubuntu1_amd64.deb,libopenblas-dev_0.2.12-1ubuntu1_amd64.deb

4.安装opencv

这里本来自己是按照网上的一个帖子,但是在安装过程中出现很多问题,出现很多依赖库需要安装,因此,在这里建议是直接从github下载编译。在这里安装中,首先需要ffmpeg,在Ubantu14.04中没有提供直接通过sudo apt-get install ffmpeg,而在Ubantu15中可以直接通过该命令进行安装。这里可以通过如下指令进行。亲测可用!

sudo apt-get-repository ppa:mc3man/trusty-media

sudo apt-get update

sudo apt-get install ffmpeg

然后可以安装

git clone https://github.com/Itseez/opencv.git opencv-2.4.9

cd opencv-2.4.9

mkdir build cd build cmake .. make

make install

如果在编译过程中出现错误,使用make clean对已经编译的进行清除

这里执行到 make install 可能会出现权限问题,那么在cmake,make,make install前面加上sudo权限即用sudo make,sudo make install

5.caffe安装

下载caffe-master,然后

cp Makefile.config.example Makefile.config

# Adjust Makefile.config (for example, if using Anaconda Python)

make all

make test

make runtest


这里提示,我遇到过的,在安装openvc是,需要对caffe的Makefile进行编辑。

IBRARIES += glog gflags protobuf boost_systemboost_filesystem m hdf5_hl hdf5 $后添加opencv_core opencv_highgui opencv_imgproc opencv_imgcodecs。不然会出现错误。

如果,我们只是使用cpu模式,那么我们在Makefile.config时,选择
CPU_ONLY := 1


由于我安装的是openblas,因此Set BLAS
:= open in Makefile.config
至此,caffe安装成功!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: