ubuntu 16.04中安装无cuda的caffe

来源:互联网 发布:js display none 编辑:程序博客网 时间:2024/06/12 23:13

ubuntu 16.04中安装无cuda的caffe

1.在虚拟机中安装ubuntu16.04的系统,安装好vmware tools

2.更换软件源,最好使用阿里云的(不推荐使用ubuntu的原因是软件源太旧容易出错),并且进行更新
sudo apt-get update
sudo apt-get upgrade

3.安装第三方依赖库(特别注意红色部分的两个,如果下载不了更换软件源)

# sudo apt-get install libatlas-base-dev# sudo apt-get install libprotobuf-dev# sudo apt-get install libleveldb-dev# sudo apt-get install libsnappy-dev# sudo apt-get install libopencv-dev# sudo apt-get install libboost-all-dev# sudo apt-get install libhdf5-serial-dev# sudo apt-get install libgflags-dev# sudo apt-get install libgoogle-glog-dev# sudo apt-get install liblmdb-dev# sudo apt-get install protobuf-compiler

4.下载caffe
sudo git clone https://github.com/BVLC/caffe.git

5.安装opencv

# cd caffe# sudo git clone https://github.com/jayrambhia/Install-OpenCV# cd Install-OpenCV/Ubuntu# sudo sh dependencies.sh# cd 2.4# sudo sh opencv2_4_10.sh

其中执行第四步之前要先从dash转换到

bash(http://blog.csdn.net/gatieme/article/details/52136411)sudo dpkg-reconfigure dash

选“no”,否则会出现不能识别function等错误
在执行第六步的时.候有可能会运行到编译到一半卡住,这是前面有一些包没有装好,这时候可以打开opencv2_4_10.sh文件然后按照里面的语句一步步的执行,里面有两个包过旧需要替换,libtiff4-dev——>libtiff5-dev,libxine-dev——>libxine2-dev,包都安装好后直接编译,过程有点久大概半个小时
注意:其中有个语句make -j(2,4,8…..),让资源集中起来处理,如果有问题可以用sudo make

6.编译caffe

# cd ~/caffe# sudo cp Makefile.config.example Makefile.config# make all

其中Makefile和Makefile.config文件有几个地方需要修改
Makefile.config:CPU前面的#去掉(( fatal error: cublas_v2.h: No such file or directory)
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include ——>INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial(两个路径中间有空格)( fatal error: hdf5.h: No such file or directory)

Makefile: LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_hl hdf5——>
    LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_serial_hl hdf5_serial`(http://blog.csdn.net/hongye000000/article/details/51043913)`

7.测试minst

# cd ~/caffe# sudo sh data/mnist/get_mnist.sh# sudo sh examples/mnist/create_mnist.sh# sudo vi examples/mnist/lenet_solver.prototxt把GPU改成CPU# sudo sh examples/mnist/train_lenet.sh

8.附加链接:
http://www.cnblogs.com/denny402/p/5067265.html

0 0
原创粉丝点击