【21天实战Caffe】学习笔记(一)Ubuntu16.04+Caffe环境搭建

  1. 安装前准备工作:

    sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler
    sudo apt-get install --no-install-recommends libboost-all-dev
    sudo apt-get install libatlas-base-dev
    sudo apt-get install the python-dev
    sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev
  2. 【可选】安装CUDA和Anaconda,详细见Ubuntu16.04+theano环境
  3. 下载caffe:

    git clone https://github.com/BVLC/caffe.git
  4. 修改配置文件:

    cd caffe/
    cp Makefile.config.example Makefile.config
  5. 修改配置文件中的各种路径

    vim Makefile.config.

    我配置好的配置文件为:

    ## Refer to http://caffe.berkeleyvision.org/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 := 1
    
    # uncomment to disable IO dependencies and corresponding data layers
    # USE_OPENCV := 0
    # USE_LEVELDB := 0
    # USE_LMDB := 0
    
    # 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 you‘re using OpenCV 3
    # OPENCV_VERSION := 3
    
    # 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 through *_61 lines for compatibility.
    # For CUDA < 8.0, comment the *_60 and *_61 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_52,code=sm_52                 -gencode arch=compute_60,code=sm_60                 -gencode arch=compute_61,code=sm_61                 -gencode arch=compute_61,code=compute_61
    # BLAS choice:
    # atlas for ATLAS (default)
    # mkl for MKL
    # open for OpenBlas
    BLAS := atlas
    # 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/blas
    
    # 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 it‘s in root.
    ANACONDA_HOME := $(HOME)/anaconda2
    PYTHON_INCLUDE := $(ANACONDA_HOME)/include                   $(ANACONDA_HOME)/include/python2.7                   $(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include
    
    # Uncomment to use Python 3 (default is Python 2)
    # PYTHON_LIBRARIES := boost_python3 python3.5m
    # PYTHON_INCLUDE := /usr/include/python3.5m #                 /usr/lib/python3.5/dist-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
    
    # Whatever else you find you need goes here.
    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
    
    # If Homebrew is installed at a non standard location (for example your home directory) and you use it for general dependencies
    # INCLUDE_DIRS += $(shell brew --prefix)/include
    # LIBRARY_DIRS += $(shell brew --prefix)/lib
    
    # NCCL acceleration switch (uncomment to build with NCCL)
    # https://github.com/NVIDIA/nccl (last tested version: v1.2.3-1+cuda8.0)
    # USE_NCCL := 1
    # Uncomment to use `pkg-config` to specify OpenCV library paths.
    # (Usually not necessary -- OpenCV libraries are normally installed in one of the above $LIBRARY_DIRS.)
    # USE_PKG_CONFIG := 1
    
    # N.B. both build and distribute dirs are cleared on `make clean`
    BUILD_DIR := build
    DISTRIBUTE_DIR := distribute
    
    # Uncomment for debugging. Does not work on OSX due to https://github.com/BVLC/caffe/issues/171
    # DEBUG := 1
    
    # The ID of the GPU that ‘make runtest‘ will use to run unit tests.
    TEST_GPUID := 0
    
    # enable pretty build (comment to see full commands)
    Q ?= @
  6. 【注意】不要直接复制粘贴(用户名不对),注意添加hdf5的有关路径,没有装CUDA的需要把CPU_ONLY := 1前的#号去掉,安装Anaconda的用户注意其文件名为~/anaconda2
  7. 编译:

    make all
    make test
    make runtest
  8. 没有错误即成功
时间: 2024-12-28 20:27:18

【21天实战Caffe】学习笔记(一)Ubuntu16.04+Caffe环境搭建的相关文章

OpenGL学习笔记: (1)mac下OpenGL环境搭建

1,OpenGL是什么 OpenGL(全写Open Graphics Library)是个定义了一个跨编程语言.跨平台的编程接口规格的专业的图形程序接口.它用于三维图像(二维的亦可),是一个功能强大,调用方便的底层图形库. 2,OpenGL能做什么 OpenGL能用来开发跨平台的渲染引擎,在Android.OSX.iOS.Windows.PS等平台均可使用 OpenGL(ES). 3,OpenGL不能做什么 OpenGL不能做物理模拟,OpenGL不能做网络通信,一句话,除了渲染以外的事情,Op

caffe学习笔记(十三)caffe图形化操作工具digits的使用

运行digits cd caffe/xsh_digist/digist ./digits-devserver 运行mnist实例 现在来运行一个实例:mnist(名符其实的helloworld) 原始数据需要的是图片,但网上提供的mnist数据并不是图片格式的数据,因此我们需要将它转换成图片才能运行. digits提供了一个脚本文件,用于下载mnist, cifar10 和cifar100 三类数据,并转换成png格式图片.文件路径为: /usr/share/digits/tools/downl

angularjs2 学习笔记(一) 开发环境搭建

开发环境,vs2013 update 5,win7 x64,目前最新angular2版本为beta 17 第一步:安装node.js 安装node.js(https://nodejs.org/en/),为的是能够使用npm获得angular2.0的开发包 验证是否安装成功 cmd下输入 node -v npm -v 第二步:在vs2013上安装typescript 安装完成后在项目中可以添加typescript项目了,并且在项目属性栏中会有typescript页 第三步:创建项目 可以将没用的都

java学习笔记 (1) —— Strut2.3.24环境搭建

1.打开MyEclipse,添加WebProject,名称为testStruts2 2.配置Tomcat环境. 1) 在窗口——首选项——MyEclipse——Servers下找到Tomcat6.x 2) 选择Enable.浏览找到本机Tomcat6文件位置 3) 找到Tomcat——conf——server.xml文件.在</Host>结束标签前添加 <Context path="/testStruts2" docBase="E:\software\MyE

Hadoop学习笔记之Hadoop伪分布式环境搭建

搭建为伪分布式Hadoop环境 1.宿主机(Windows)与客户机(安装在虚拟机中的Linux)网络连接. a) Host-only 宿主机与客户机单独组网: 好处:网络隔离: 坏处:虚拟机和其他服务器之间不能通讯: b) Bridge 桥接 宿主机与客户机在同一个局域网中. 好处:窦在同一个局域网,可以互相访问: 坏处:不完全. 2.Hadoop的为分布式安装步骤 a) 设置静态IP 在centos下左面上右上角图标右键修改: 重启网卡service network restart; 验证:

OpenStack 学习笔记(二):OpenStack 基础环境搭建

环境:     系统版本:CentOS-7.0  控制节点:192.168.100.120  计算节点:192.168.100.121 1.同步时间 [[email protected] ~]# hostnamectl set-hostname openstack [[email protected] ~]# su - [[email protected] ~]# ntpdate pool.ntp.org 2.添加mitaka源 [[email protected] ~]# wget http:

老邓的andorid学习笔记-Android 4.0 开发环境搭建

目前android版本早已经四4.xx了,5.0的版本也快出来了.  关于基本环境搭建有好多的文章都介绍过. 我在这里简单的整理了一下,就不用自己专门写此类的文章了. Android SDK 4.0.3 开发环境配置及运行     http://bk-lin.iteye.com/blog/1477808 android 4.0 for windows 7 开发环境搭建   http://cash.iteye.com/blog/1463253 Windows搭建Eclipse+JDK+SDK的An

ECMAScript 6 学习笔记(1)--编译环境搭建

参考文档:http://es6.ruanyifeng.com/#docs/intro https://www.w3cschool.cn/ecmascript/ ECMAScript是一种定义脚本语言的规范,Javascript正是基于这种规范的一种实现.JavaScript是一种弱类型定义.动态编程脚本语言,通过解释器运行而非编译机器码运行. ECMAScript6调试环境配置,最新版本的nodejs对ES6能够大部分支持,并非全部.可以用ES-Checker对安装的nodejs检测支持es6的

ubuntu16.04 开发环境搭建

相关软件 Linux版搜狗拼音输入法下载地址:http://pinyin.sogou.com/linux/ 开始安装 1 2 3 4 5 6 7 8 # 查看依赖关系 sudo dpkg -i sogoupinyin_2.0.0.0068_amd64.deb # 解决大部分依赖 sudo apt-get -f install # 正常情况下会提示找不到 fonts-droid ,下面进行安装 sudo dpkg -i fonts-droid_4.4.4r2-6_all.deb # 安装搜狗输入法