ubuntu 16.04源码编译和配置caffe详细教程 | Install and Configure Caffe on ubuntu 16.04

该教程详细介绍了如何在Ubuntu 16.04上安装和配置Caffe,包括安装CUDA、cuDNN、protobuf、OpenCV,以及解决gcc和gflags错误,编译和运行Caffe的Python和C++版本。
摘要由CSDN通过智能技术生成

本文首发于个人博客https://kezunlin.me/post/b90033a9/,欢迎阅读!

Install and Configure Caffe on ubuntu 16.04

Series

Guide

requirements:

  • NVIDIA driver 396.54
  • CUDA 8.0 cudnn 6.0.21
  • CUDA 9.2 cudnn 7.1.4
  • opencv 3.1.0 --->3.3.0
  • python 2.7 numpy 1.15.1
  • python 3.5.2 numpy 1.16.2
  • protobuf 3.6.1 (static)
  • caffe latest

默认的protobuf,2.6.1测试通过。

此处,使用最新的3.6.1 也可以,编译caffe需要加上-std=c 11

install CUDA cudnn

see install and configure cuda 9.2 with cudnn 7.1 on ubuntu 16.04

tips: we need to recompile caffe with cudnn 7.1

before we compile caffe, move caffe/python/caffe/selective_search_ijcv_with_python folder outside caffe source folder, otherwise error occurs.

recompile caffe with cudnn

install protobuf

see Part 1: compile protobuf-cpp on ubuntu 16.04

    which protoc 
    /usr/local/bin/protoc
    protoc --version
    libprotoc 3.6.1

caffe使用static的libprotoc 3.6.1

install opencv

see compile opencv on ubuntu 16.04

     which opencv_version
    /usr/local/bin/opencv_version
    opencv_version 
    3.3.0

python

    python --version
    Python 2.7.12

check numpy version

    import numpy
    numpy.__version__
    '1.15.1'
    import numpy
    import inspect
    inspect.getfile(numpy)
    '/usr/local/lib/python2.7/dist-packages/numpy/__init__.pyc'

compile caffe

clone repo

    git clone https://github.com/BVLC/caffe.git 
    cd caffe

update repo

update at 20180822.

if you change your local Makefile and git pull origin master merge conflict, solution

    git checkout HEAD Makefile
    git pull origin master

configure

    mkdir build && cd build && cmake-gui ..

cmake-gui options

    USE_CUDNN ON
    USE_OPENCV ON
    Build_python ON
    Build_python_layer ON
    BLAS atlas
    CMAKE_CXX_FLGAS -std=c  11
    CMAKE_INSTALL_PREFIX /home/kezunlin/program/caffe/build/install

使用-std=c 11

configure output

    Dependencies:
      BLAS              :   Yes (Atlas)
      Boost             :   Yes (ver. 1.66)
      glog              :   Yes
      gflags            :   Yes
      protobuf          :   Yes (ver. 3.6.1)
      lmdb              :   Yes (ver. 0.9.17)
      LevelDB           :   Yes (ver. 1.18)
      Snappy            :   Yes (ver. 1.1.3)
      OpenCV            :   Yes (ver. 3.1.0)
      CUDA              :   Yes (ver. 9.2)
    NVIDIA CUDA:
      Target GPU(s)     :   Auto
      GPU arch(s)       :   sm_61
      cuDNN             :   Yes (ver. 7.1.4)
    Python:
      Interpreter       :   /usr/bin/python2.7 (ver. 2.7.12)
      Libraries         :   /usr/lib/x86_64-linux-gnu/libpython2.7.so (ver 2.7.12)
      NumPy             :   /usr/lib/python2.7/dist-packages/numpy/core/include (ver 1.51.1)
    Documentaion:
      Doxygen           :   /usr/bin/doxygen (1.8.11)
      config_file       :   /home/kezunlin/program/caffe/.Doxyfile
<
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值