




已阅读5页,还剩5页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
caffe+opencv+openblas+Anaconda+ubuntu14.04配置本安装教程主要包含7个部分,包括:第一部分:安装开发依赖包第二部分:opencv安装和调试第三部分:Anaconda安装和调试第四部分:openblas安装和调试第五部分:Caffe的安装和测试第六步分:在minist的数据包上训练测试第七部分:出现的问题及解决方案1. 安装开发依赖包在linux命令行指令中安装开发所需要的一些基本包指令:sudo apt-get install build-essential安装caffe所需要的一些依赖包:sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libboost-all-dev libhdf5-serial-dev libgflags-dev libgoogle-glog-dev liblmdb-dev protobuf-compiler install-gcc-multilibinstall-gfortrain-multilib 安装Anaconda所需要的依赖包:python-dev python-pip2. opencv安装和调试安装opencv时没有手动安装, 采用Github上有人已经写好了完整的安装脚本,选择这个链接/jayrambhia/Install-OpenCV,下载后解压,然后进去该目录,选择自己的操作系统,比如我的是Ubuntu,执行sudo ./dependencies.shsudo ./open2_4_9.sh其中第一步是安装依赖项opencv的所有依赖项,该依赖项就在这个dependencies.sh文件中,第二部是安装opencv,包括下载解压存放opencv等操作,这个过程大概一两个小时,慢慢等。3. Anaconda安装和调试可以按照官方建议安装anaconda包。 在anaconda官网(https:/www.continuum.io/downloads#all)下载.sh文件,切换到文件所在目录,执行.sh文件,最后添加bin目录到环境变量即可。在/etc/ld.so.conf最后加入以下路径,并没有出现重启不能进入界面的问题/home/username/anaconda/lib在/.bashrc最后添加下边路径exportLD_LIBRARY_PATH=/home/username/anaconda/lib:$LD_LIBRARY_PATH4 openblas安装和调试在官网下载openblas,在这个链接上选择和系统相匹配的版本(/ubuntu/+source/openblas),并解压编译执行,具体步骤如下:首先建立一个文件夹用来盛放解压后的openblas $mkdiropenblas $cdopenblas 然后编译 $make 这个编译是多线程编译。编译好之后安装之 $sudomakeinstall安装后即可。5. Caffe的安装和测试将下载后的caffe-master.zip解压,并将解压后的文件放入要存放的目录,进入caffe-master目录, 首先复制一份Makefile.configcp Makefile.config.example Makefile.config然后修改Makefile.config中的参数:gedit Makefile.config主要修改的参数如下:然后编译makeall-j4maketestmakeruntest最后看是否能通过编译。6. 在minist的数据包上训练测试首先在根目录上获取数据集并解压cd $CAFFE_ROOT./data/mnist/get_mnist.sh然后执行./examples/mnist/create_mnist.sh将数据格式转换为lmdb格式。并将新生成的2个文件mnist-train-lmdb 和 mnist-test-lmdb放于和create_mnist.sh相同目录下。最后执行测试集,指令如下:./examples/mnist/train_lenet.sh到此为止即把caffe的安装测试工作完成了。7.出现的部分问题及解决方法1.在安装过程中出现:linktest.c:(.text.startup+0x55ab): undefined reference to LAPACKE_clagsylinktest.c:(.text.startup+0x55b1): undefined reference to LAPACKE_clagsy_worklinktest.c:(.text.startup+0x55b6): undefined reference to LAPACKE_dlagsylinktest.c:(.text.startup+0x55bb): undefined reference to LAPACKE_dlagsy_worklinktest.c:(.text.startup+0x55c1): undefined reference to LAPACKE_slagsylinktest.c:(.text.startup+0x55c6): undefined reference to LAPACKE_slagsy_worklinktest.c:(.text.startup+0x55cb): undefined reference to LAPACKE_zlagsylinktest.c:(.text.startup+0x55d1): undefined reference to LAPACKE_zlagsy_workcollect2: error: ld returned 1 exit statusmake1: * ./libopenblas_haswell-r0.2.15.so Error 1make1: Leaving directory /usr/local/OpenBLAS-0.2.15/exportsmake: * shared Error 2lpgubuntu:/usr/local/OpenBLAS-0.2.15$ sudo make installgetarch_2nd.c: In function main:getarch_2nd.c:67:5: warning: format %ld expects argument of type long int, but argument 2 has type unsigned int -Wformat= printf(#define SLOCAL_BUFFER_SIZEt%ldn, (SGEMM_DEFAULT_Q * SGEMM_DEFAULT_UNROLL_N * 4 * 1 * sizeof(float); getarch_2nd.c:68:5: warning: format %ld expects argument of type long int, but argument 2 has type unsigned int -Wformat= printf(#define DLOCAL_BUFFER_SIZEt%ldn, (DGEMM_DEFAULT_Q * DGEMM_DEFAULT_UNROLL_N * 2 * 1 * sizeof(double); getarch_2nd.c:69:5: warning: format %ld expects argument of type long int, but argument 2 has type unsigned int -Wformat= printf(#define CLOCAL_BUFFER_SIZEt%ldn, (CGEMM_DEFAULT_Q * CGEMM_DEFAULT_UNROLL_N * 4 * 2 * sizeof(float); getarch_2nd.c:70:5: warning: format %ld expects argument of type long int, but argument 2 has type unsigned int -Wformat= printf(#define ZLOCAL_BUFFER_SIZEt%ldn, (ZGEMM_DEFAULT_Q * ZGEMM_DEFAULT_UNROLL_N * 2 * 2 * sizeof(double); make -j 1 -f Makefile.install installmake1: Entering directory /usr/local/OpenBLAS-0.2.15Generating openblas_config.h in /opt/OpenBLAS/includeGenerating f77blas.h in /opt/OpenBLAS/includeGenerating cblas.h in /opt/OpenBLAS/includeCopying LAPACKE header files to /opt/OpenBLAS/includeCopying the static library to /opt/OpenBLAS/libCopying the shared library to /opt/OpenBLAS/libGenerating OpenBLASConfig.cmake in /opt/OpenBLAS/lib/cmake/openblasGenerating OpenBLASConfigVersion.cmake in /opt/OpenBLAS/lib/cmake/openblasInstall OK!make1: Leaving directory /usr/local/OpenBLAS-0.2.15这种问题通过以下方法解决:首先添加依赖库install-gcc-multilib install-gfortran-multilib libopenblas,然后执行make TARGET=BANIS SINARY=32即可解决问题。2.修改后的gedit Makefile.config的全部文件为# Refer to /installation.html# Contributions simplifying and improving our build system are welcome!# cuDNN acceleration switch (uncomment to build with cuDNN).#USE_CUDNN := 1# CPU-only switch (uncomment to build without GPU support).# CPU_ONLY := 1CPU_ONLY := 1# uncomment to disable IO dependencies and corresponding data layersUSE_OPENCV := 1 USE_LEVELDB := 1 USE_LMDB := 1# uncomment to allow MDB_NOLOCK when reading LMDB files (only if necessary)#You should not set this flag if you will be reading LMDBs with any#possibility of simultaneous read and write# ALLOW_LMDB_NOLOCK := 1# Uncomment if youre using OpenCV 3OPENCV_VERSION := 2.4.9# To customize your choice of compiler, uncomment and set the following.# N.B. the default for Linux is g+ and the default for OSX is clang+# CUSTOM_CXX := g+# CUDA directory contains bin/ and lib/ directories that we need.#CUDA_DIR := /usr/local/cuda# On Ubuntu 14.04, if cuda tools are installed via# sudo apt-get install nvidia-cuda-toolkit then use this instead:# CUDA_DIR := /usr# 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# BLAS choice:# atlas for ATLAS (default)# mkl for MKL# open for OpenBlas#BLAS := atlasBLAS := 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/blasBLAS_INCLUDE := /usr/local/OpenBLAS-0.2.15BLAS_LIB := /usr/local/OpenBLAS-0.2.15#export LD_LIBRARY_PATH=/usr/lib/openblas-base/# Homebrew puts openblas in a directory that is not on the standard search path# BLAS_INCLUDE := $(shell brew -prefix openblas)/include# BLAS_LIB := $(shell brew -prefix openblas)/lib# This is required only if you will compile the matlab interface.# MATLAB directory should contain the mex binary in /bin.# MATLAB_DIR := /usr/local# MATLAB_DIR := /Applications/MATLAB_R2012b.app# NOTE: this is required only if you will compile the python interface.# We need to be able to find Python.h and numpy/arrayobject.h.PYTHON_INCLUDE := /usr/include/python2.7 /usr/lib/python2.7/dist-packages/numpy/core/include# Anaconda Python distribution is quite popular. Include path:# Verify anaconda location, sometimes its in root.# ANACONDA_HOME := $(HOME)/anaconda# PYTHON_INCLUDE := $(ANACONDA_HOME)/include # $(ANACONDA_HOME)/include/python2.7 # $(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include # We need to be able to find libpythonX.X.so or .dylib.PYTHON_LIB := /usr/lib# PYTHON_LIB := $(ANACONDA_HOME)/lib# Homebrew installs numpy in a non standard path (keg only)# PYTHON_INCLUDE += $(dir $(shell python -c import numpy.core; print(numpy.core._file_)/include# PYTHON_LIB += $(shell brew -prefix numpy)/lib# Uncomment to support layers written in Python (will link against Python libs)# WITH_PYTHON_LAYER := 1# Wh
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 湖南省湘一名校联盟2024-2025学年高一下学期4月期中联考政治试题(原卷版)
- 大一自我鉴定总结模版
- 车间质检员年终总结
- 玉林消防考试题目及答案
- 宜兴公务员试题及答案
- 医院护士面试题及答案
- 刑警公务员试题及答案
- 早教机构智能教具购置与教师培训一体化服务协议
- 忠诚协议中精神损害赔偿免除及责任承担细则合同
- 新疆公务员试题及答案
- 【中考真题汇编】专项查漏补缺现代文阅读-2025年中考语文(含答案)
- 手表质押借款协议书
- 《流感中医治疗》课件
- 2025河南省水利第一工程局集团有限公司招聘49人笔试参考题库附带答案详解
- 2025四川西南发展控股集团有限公司招聘工作人员65人笔试参考题库附带答案详解
- 医院培训课件:《走进康复》
- 《智能电网计量装置》课件
- 2025年河南省郑州市外国语中学高考生物三模试卷含解析
- (三模)温州市2025届高三第三次适应性考试英语试卷(含答案)
- 美团代运营合同协议模板
- 同型半胱氨酸试题及答案
评论
0/150
提交评论