标签:end ORC step 安装教程 proc ipy post network flags
这是caffe初学者系列教程的第二部,旨在帮助更多对深度学习感兴趣的同学们!第一部可以参考以下地址:
好啦,开始我们的教程吧!
前言:
之前的第一部教程发布以后,很受欢迎,看样子我的努力没白费,毕竟写博文花了我好几个小时,感谢同学们的支持啦^_^
亲测教程:
本教程需要准备的文件有:Ubuntu16.04, Opencv3(必要), Matlab2014a.
(1)Ubuntu16.04我下载的是Kylin版本,安装教程可以参考以下博客:
https://blog.csdn.net/qq_20444875/article/details/78887768
Ubuntu16.04下载地址直接复制到迅雷就可以下载:
http://cdimage.ubuntu.com/ubuntukylin/releases/16.04/release/ubuntukylin-16.04.4-desktop-amd64.iso
(2)Opencv3的安装(必要),参考以下博客:
https://blog.csdn.net/CupidYzw97/article/details/74857467
(3)Matlab2014a的安装,参考以下博客:
https://www.cnblogs.com/nowornever-L/p/5649078.html
至此,同学你应该装好上述环境了,接下来进入我们激动人心的时刻吧!
Step1:打开终端,输入:
sudo apt-get update
Step2:安装必要的依赖:
sudo apt-get install git sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler sudo apt-get install build-essential sudo apt-get install --no-install-recommends libboost-all-dev sudo apt-get install libatlas-base-dev sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev
Step3:官网拉取源码:
cd git clone https://github.com/BVLC/caffe.git
注意第三步如果终端下载太慢,可以将该网址
https://github.com/BVLC/caffe.git
复制到浏览器地址栏,然后手动点击下载ZIP包,“caffe-master.zip”,之后解压到home文件夹即可,将解压出来的文件夹重命名为“caffe-matlab”。
Step4:安装第二部分依赖:
sudo apt-get install libblas-dev liblapack-dev libatlas-base-dev gfortran python-numpy sudo apt-get install python-pip sudo apt-get install python-numpy python-scipy python-matplotlib python-sklearn sudo apt-get install python-skimage python-h5py python-protobuf python-leveldb sudo apt-get install python-networkx python-nose python-pandas sudo apt-get install python-gflags Cython ipython sudo pip install --upgrade matplotlib sudo apt-get update
Step5:修改Makefile.config配置文件:
cd caffe-matlab cp Makefile.config.example Makefile.config sudo gedit Makefile.config
修改4处:
将“CPU_ONLY”打开,改成:
CPU_ONLY := 1
将“OPENCV_VERSION”打开,改成:
OPENCV_VERSION := 3
将Matlab路径配置一下,改成;
MATLAB_DIR := /usr/local/MATLAB/R2014a
将包含路径配置一下,改成:
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
Step6:修改Makefile文件:
sudo gedit Makefile
在CXXFLAGS += -MMP -MP下面加:
CXXFLAGS += -std=c++11
将:
NVCCFLAGS +=-ccbin=$(CXX) -Xcompiler-fPIC $(COMMON_FLAGS)
替换为:
NVCCFLAGS += -D_FORCE_INLINES -ccbin=$(CXX) -Xcompiler-fPIC $(COMMON_FLAGS)
Step7:手动加入环境变量,如下:
sudo gedit ~/.bashrc
末尾加入:
export PATH=$PATH:/usr/local/R2014a/bin export LD_LIBRARY_PATH=/usr/local/R2014a/sys/os/glnxa64 export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6 export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:/usr/local/cuda-8.0/lib64 export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4:/usr/lib/x86_64-linux-gnu/libopencv_imgproc.so.2.4:/usr/lib/x86_64-linux-gnu/libopencv_core.so.2.4:/usr/lib/x86_64-linux-gnu/libstdc++.so.6:/usr/lib/x86_64-linux-gnu/libfreetype.so.6
或者终端直接输入:
export PATH=$PATH:/usr/local/R2014a/bin export LD_LIBRARY_PATH=/usr/local/R2014a/sys/os/glnxa64 export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6 export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:/usr/local/cuda-8.0/lib64 export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4:/usr/lib/x86_64-linux-gnu/libopencv_imgproc.so.2.4:/usr/lib/x86_64-linux-gnu/libopencv_core.so.2.4:/usr/lib/x86_64-linux-gnu/libstdc++.so.6:/usr/lib/x86_64-linux-gnu/libfreetype.so.6
重启电脑。
Step8:编译及测试:
make all -j4 make test -j4
make runtest -j4 make matcaffe -j4 make distribute
make mattest
Caffe初学者第二部:Ubuntu16.04上安装caffe(CPU)+Matlab2014a+Opencv3的详细过程 (亲测成功, 20180529更新)
标签:end ORC step 安装教程 proc ipy post network flags
原文地址:https://www.cnblogs.com/Qsir/p/9105798.html