虚拟机下装cpu版的caffe
来源:互联网 发布:淘宝订购的应用 编辑:程序博客网 时间:2024/06/05 07:27
Ubuntu版本:Ubuntu 15.10
因为电脑显卡不行,并且在虚拟机下,只是尝试一下cpu版的caffe安装。
安装步骤:
1、先下载caffe
# sudo git clone https://github.com/BVLC/caffe.git
2、安装一系列依赖库
# 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
3、安装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
4、编译caffe
# cd ~/caffe# sudo cp Makefile.config.example Makefile.config# make all
注:make all的时候出错了
说缺少hdf5.h文件
解决方法:
1)在Makefile.config文件的第85行,添加/usr/include/hdf5/serial/ 到 INCLUDE_DIRS,也就是把下面第一行代码改为第二行代码。
INCLUDE_DIRS:=$(PYTHON_INCLUDE) /usr/local/includeINCLUDE_DIRS:=$(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial/
2)在Makefile文件的第173行,把 hdf5_hl 和hdf5修改为hdf5_serial_hl 和 hdf5_serial,也就是把下面第一行代码改为第二行代码。
LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_hl hdf5LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_serial_hl hdf5_serial
修改上面的文件时需要root权限,可用sudo vi Makefile.config命令在vi环境下修改好。
还有一点:
在make all前需要编辑Makefile文件,主要是一些配置选项,有cuda和没有cuda不一样.
因为我用的cpu,需要把下面cpu_only这句uncomment,cudnn这句comment。
# cuDNN acceleration switch (uncomment to build with cuDNN).# USE_CUDNN := 1# CPU-only switch (uncomment to build without GPU support).CPU_ONLY := 1
还有这几句,都注调了。# CUDA architecture setting: going with all of them.# For CUDA < 6.0, comment the *_50 lines for compatibility.# CUDA_ARCH := -gencode arch=compute_20,code=sm_20 \# -gencode arch=compute_20,code=sm_21 \# -gencode arch=compute_30,code=sm_30 \# -gencode arch=compute_35,code=sm_35 \# -gencode arch=compute_50,code=sm_50 \# -gencode arch=compute_50,code=compute_50
大致就这两个错误解决就可以sudo make all 成功了。
make allmake pycaffe
测试(可选)
make testmake runtest
如果出现一系列的 run ok,应该是装好了。
5、测试mnist数据集
# cd ~/caffe# sudo sh data/mnist/get_mnist.sh# sudo sh examples/mnist/create_mnist.sh运行这一步中第三句出了个错误,说convert_mnist_data.bin:not found,我找了下convert_mnist_data这个名字,只找到一个cpp文件,最后是重新make all了一遍好了。
如果有GPU可以运行下一步,因为我只有cpu,所以还要改点东西。
# sudo vi examples/mnist/lenet_solver.prototxt将最后一行的solver_mode:GPU改为solver_mode:CPU
然后执行下面的命令测试
sudo sh ./examples/mnist/train_lenet.sh然后等着看结果
最终的精度达到了0.9914,很高的精度
参考资源
1)http://www.cnblogs.com/denny402/p/5067265.html
2)http://blog.csdn.net/xue_wenyuan/article/details/52037121
3)http://suanfazu.com/t/ubuntu-14-04-caffe/447
4)http://blog.csdn.net/hongye000000/article/details/51043913
5)http://coldmooon.github.io/2015/08/03/caffe_install/
6)https://gist.github.com/bearpaw/c38ef18ec45ba6548ec0
- 虚拟机下装cpu版的caffe
- Caffe(1):虚拟机上的ubuntu16.04配置caffe(CPU版)
- 虚拟机下Ubuntu安装CPU版本的caffe
- VM虚拟机 ubuntu16.04配置CPU版本的caffe
- 虚拟机环境下Ubuntu系统的Caffe安装 CPU-ONLY
- caffe+CPU︱虚拟机+Ubuntu16.04+CPU+caffe安装笔记
- 虚拟机Ubuntu14.04+caffe+CPU安装教程
- Vmware虚拟机安装caffe,Ubuntu安装caffe,CPU only版本
- 虚拟机下装oracle10G ASM
- VMware虚拟机下装win7
- window下装ubuntu虚拟机
- caffe 的cpu only安装
- ubuntu安装cpu版caffe
- 虚拟机中ubuntu17.04+python3.6+anaconda3配置caffe(CPU)
- 安装caffe(CPU版)遇到的问题
- Ubuntu16.04下的caffe配置(仅cpu版)
- LUbuntu安装配置CPU版本的Caffe
- Windows安装配置CPU版本的Caffe
- 线程实现cp-r与ls-l
- HDU-1879-继续畅通工程
- 知识体系
- 在ls-l中利用execl添加cp-r进程
- 自定义控件-视觉特效
- 虚拟机下装cpu版的caffe
- 通达OA最新官方原版9.5.160913+和谐补丁+ 电脑微信钉钉多端登录 集成全功能组件
- Windows下Java调用BAT批处理不弹出cmd窗口
- JavaWeb:过滤器Filter
- 没有事业的女孩子很悲惨 - - - 一位老总的话!
- 标准80C51单片机模拟I2C总线的主机程序
- Windows的Python3.5下keras安装
- redis与DB数据同步问题
- 设计模式随笔-命令模式