一、事先声明:
1、Ubuntu版本:Ubuntu使用的是16.04。而不是16.04.1或16.04.2,这三个是有区别的。笔者曾有过这样的经历,Git上一个SLAM地图构建程序在Ubuntu14.04.3上可以正常make与工作,而14.04.4却一塌Error。。。

可自己在Google搜索关键字“Ubuntu16.04.1”做“引子”找到历史版本,第一个就是。在此我们放出网址:

http://old-releases.ubuntu.com/releases/16.04.1/

问:有两个“64-bit PC (AMD64) desktop image”怎么办?那个才是16.04?
答:点进去看看ISO前缀名称!

2、为什么免安装OpenCV?很简单,因为Ubuntu自带!但不是OpenCV3,而是OpenCV 2.x.x.x,具体是多少我忘了,你可用命令

  1. pkg-config --modversion opencv

查询一下,faster-rcnn用Ubuntu自带的OpenCV2的即可正常运行。如果您非要使用CV3,这里也给出参考教程。要相信OpenCV3不是三四行shell就能装好的,不信你去搜搜专门安装CV3的博客。OpenCV3.2.0安装链接如下
https://www.linuxhint.com/how-to-install-opencv-on-ubuntu/

二、软件版本:

Ubuntu16.04

Cuda8.0

1080ti驱动

OpenCV3.2.0

cuDNN5.1 (5.1.10)

glog-0.3.3.tar.gz

注:以上这些都可以事先下载好。

注意:安装完Ubuntu后记得关闭“自动更新”。笔者装机完,正常使用两天后,出现了ubuntu反复登录桌面的问题。我是重装了Unity,也装了GDM。但愿你不会出现这类问题,如果出现了,下面给出解决链接。

http://www.linuxidc.com/Linux/2011-07/39491.htm

http://forum.ubuntu.org.cn/viewtopic.PHP?t=460910

三、安装Caffe参考:

1、主要参考:

迷途de小狼:

http://blog.csdn.NET/u010733679/article/details/52249503

2、辅助参考:

http://www.jianshu.com/p/69a10d0a24b9

http://blog.csdn.Net/yan_song_/article/details/53154611

http://www.linuxidc.com/Linux/2016-09/135016.htm

http://blog.csdn.net/zhangzhenyuancs/article/details/52261004

3、声明与建议:

在此感谢几位网友的博客,正是参考了几位大神的博客才有我的成功安装。如有版权问题,请联系我,谢谢。

另外就是给要安装的朋友们给两个建议,自己搜索、或从上面的参考中至少选择三四篇文章通篇阅读一下,形成适合自己的安装思路。别人(包括本Blog)的环境都可能和屏幕前的你有所出入,所以要有所取舍。

四、安装Caffe步骤:

1、安装Ubuntu16.04

120G SSD:

/boot 400MB

/ SSD剩余所有

swap 内存两倍空间(心疼SSD的可放在2T机械)

2T

/home

2、安装1080ti驱动

  1. Ctrl+alt+F1//进入字符界面
  2. sudo service lightdm stop //关闭lightdm登录管理器
  3. sudo chmod 755 NVIDIA-Linux-x86_64-378.13.run  //获取权限
  4. sudo ./NVIDIA-Linux-x86_64-378.13.run  //安装驱动

Accept

Continue installation

安装完成之后

sudo service lightdm start

3、安装Cuda8.0

  1. sudo sh ./cuda_8.0.61_375.26_linux-run

进入安装命令行
---Do you accept the previously read EULA?
accept/decline/quit: accept
---Install NVIDIA Accelerated Graphics Driver for Linux-x86_64361.62? 
(y)es/(n)o/(q)uit: n
---Install the CUDA 8.0 Toolkit? 
(y)es/(n)o/(q)uit: y
---Enter Toolkit Location 
[ default is /usr/local/cuda-8.0 ]:回车
---Do you want to install a symbolic link at /usr/local/cuda?
(y)es/(n)o/(q)uit: y
---Install the CUDA 8.0 Samples? 
(y)es/(n)o/(q)uit: y
---Enter CUDA Samples Location 
[ default is /home/duan ]:回车

4、安装OpenCV(可跳过,Ubuntu默认安装cv2):

见第一章网址,不用修改什么源文件。

注:如果你是4/8线程可用下代码加速编译:

  1. make -j4       #四核运算

5、安装依赖项:

1)Google Logging Library(glog),下载地址:https://code.google.com/p/google-glog/,然后解压安装:
$ tar zxvf glog-0.3.3.tar.gz
$ cd glog-0.3.3 
$./configure
$ make
$ sudo make install
如果没有权限就chmod a+x glog-0.3.3 -R , 或者索性 chmod 777 glog-0.3.3 -R 。

2)其他依赖项,确保都成功

$ sudo apt-get install -y libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libboost-all-dev libhdf5-serial-dev libgflags-dev libgoogle-glog-dev liblmdb-dev protobuf-compiler protobuf-c-compiler protobuf-compiler

6、安装Caffe,并用MNIST数据集测试

1)安装pycaffe必须的一些依赖项:

sudo apt-get install -y Python-numpy python-scipy python-matplotlib python-sklearn python-skimage python-h5py python-protobuf python-leveldb python-networkx python-nose python-pandas python-gflags cython ipython

2)安装配置nVidia cuDNN 加速Caffe模型运算

  1. 1. $ sudo cp include/cudnn.h /usr/local/include
  2. 2. $ sudo cp lib64/libcudnn.* /usr/local/lib
  3. 3. $ sudo ln -sf /usr/local/lib/libcudnn.so.5.1.10 /usr/local/lib/libcudnn.so.5
  4. 4. $ sudo ln -sf /usr/local/lib/libcudnn.so.5 /usr/local/lib/libcudnn.so
  5. 5. $ sudo ldconfig -v

注:大家根据自己的cuDNN版本修改;如果懒于敲目录,可在Unity文件管理器下将文件夹拖入终端;终端下的“粘贴”快捷键:Ctrl+Shift+v。

3)切换到Caffe-master的文件夹,生成Makefile.config配置文件,执行:

  1. $ cp Makefile.config.example Makefile.config

4)配置Makefile.config文件

a.去掉“USE_CUDNN := 1”前面的#

b.根据前面自己的需求,选择性去掉“OPENCV_VERSION :=3”前面的#

c.配置一些引用文件(增加部分主要是解决新版本下,HDF5的路径问题)
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/lib/x86_64-linux-gnu/hdf5/serial/include
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu/hdf5/serial

下面贴出我的Makefile.config文件

  1. ## Refer to http://caffe.berkeleyvision.org/installation.html
  2. # Contributions simplifying and improving our build system are welcome!
  3. # cuDNN acceleration switch (uncomment to build with cuDNN).
  4. USE_CUDNN := 1
  5. # CPU-only switch (uncomment to build without GPU support).
  6. # CPU_ONLY := 1
  7. # uncomment to disable IO dependencies and corresponding data layers
  8. # USE_OPENCV := 0
  9. # USE_LEVELDB := 0
  10. # USE_LMDB := 0
  11. # uncomment to allow MDB_NOLOCK when reading LMDB files (only if necessary)
  12. #   You should not set this flag if you will be reading LMDBs with any
  13. #   possibility of simultaneous read and write
  14. # ALLOW_LMDB_NOLOCK := 1
  15. # Uncomment if you're using OpenCV 3
  16. # OPENCV_VERSION := 3
  17. # To customize your choice of compiler, uncomment and set the following.
  18. # N.B. the default for Linux is g++ and the default for OSX is clang++
  19. # CUSTOM_CXX := g++
  20. # CUDA directory contains bin/ and lib/ directories that we need.
  21. CUDA_DIR := /usr/local/cuda
  22. # On Ubuntu 14.04, if cuda tools are installed via
  23. # "sudo apt-get install nvidia-cuda-toolkit" then use this instead:
  24. # CUDA_DIR := /usr
  25. # CUDA architecture setting: going with all of them.
  26. # For CUDA < 6.0, comment the *_50 through *_61 lines for compatibility.
  27. # For CUDA < 8.0, comment the *_60 and *_61 lines for compatibility.
  28. CUDA_ARCH := -gencode arch=compute_20,code=sm_20 \
  29. -gencode arch=compute_20,code=sm_21 \
  30. -gencode arch=compute_30,code=sm_30 \
  31. -gencode arch=compute_35,code=sm_35 \
  32. -gencode arch=compute_50,code=sm_50 \
  33. -gencode arch=compute_52,code=sm_52 \
  34. -gencode arch=compute_60,code=sm_60 \
  35. -gencode arch=compute_61,code=sm_61 \
  36. -gencode arch=compute_61,code=compute_61
  37. # BLAS choice:
  38. # atlas for ATLAS (default)
  39. # mkl for MKL
  40. # open for OpenBlas
  41. BLAS := atlas
  42. # Custom (MKL/ATLAS/OpenBLAS) include and lib directories.
  43. # Leave commented to accept the defaults for your choice of BLAS
  44. # (which should work)!
  45. # BLAS_INCLUDE := /path/to/your/blas
  46. # BLAS_LIB := /path/to/your/blas
  47. # Homebrew puts openblas in a directory that is not on the standard search path
  48. # BLAS_INCLUDE := $(shell brew --prefix openblas)/include
  49. # BLAS_LIB := $(shell brew --prefix openblas)/lib
  50. # This is required only if you will compile the matlab interface.
  51. # MATLAB directory should contain the mex binary in /bin.
  52. # MATLAB_DIR := /usr/local
  53. # MATLAB_DIR := /Applications/MATLAB_R2012b.app
  54. # NOTE: this is required only if you will compile the python interface.
  55. # We need to be able to find Python.h and numpy/arrayobject.h.
  56. PYTHON_INCLUDE := /usr/include/python2.7 \
  57. /usr/lib/python2.7/dist-packages/numpy/core/include
  58. # Anaconda Python distribution is quite popular. Include path:
  59. # Verify anaconda location, sometimes it's in root.
  60. # ANACONDA_HOME := $(HOME)/anaconda
  61. # PYTHON_INCLUDE := $(ANACONDA_HOME)/include \
  62. # $(ANACONDA_HOME)/include/python2.7 \
  63. # $(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include
  64. # Uncomment to use Python 3 (default is Python 2)
  65. # PYTHON_LIBRARIES := boost_python3 python3.5m
  66. # PYTHON_INCLUDE := /usr/include/python3.5m \
  67. #                 /usr/lib/python3.5/dist-packages/numpy/core/include
  68. # We need to be able to find libpythonX.X.so or .dylib.
  69. PYTHON_LIB := /usr/lib
  70. # PYTHON_LIB := $(ANACONDA_HOME)/lib
  71. # Homebrew installs numpy in a non standard path (keg only)
  72. # PYTHON_INCLUDE += $(dir $(shell python -c 'import numpy.core; print(numpy.core.__file__)'))/include
  73. # PYTHON_LIB += $(shell brew --prefix numpy)/lib
  74. # Uncomment to support layers written in Python (will link against Python libs)
  75. # WITH_PYTHON_LAYER := 1
  76. # Whatever else you find you need goes here.
  77. INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/lib/x86_64-linux-gnu/hdf5/serial/include
  78. LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu/hdf5/serial
  79. # If Homebrew is installed at a non standard location (for example your home directory) and you use it for general dependencies
  80. # INCLUDE_DIRS += $(shell brew --prefix)/include
  81. # LIBRARY_DIRS += $(shell brew --prefix)/lib
  82. # NCCL acceleration switch (uncomment to build with NCCL)
  83. # https://github.com/NVIDIA/nccl (last tested version: v1.2.3-1+cuda8.0)
  84. # USE_NCCL := 1
  85. # Uncomment to use `pkg-config` to specify OpenCV library paths.
  86. # (Usually not necessary -- OpenCV libraries are normally installed in one of the above $LIBRARY_DIRS.)
  87. # USE_PKG_CONFIG := 1
  88. # N.B. both build and distribute dirs are cleared on `make clean`
  89. BUILD_DIR := build
  90. DISTRIBUTE_DIR := distribute
  91. # Uncomment for debugging. Does not work on OSX due to https://github.com/BVLC/caffe/issues/171
  92. # DEBUG := 1
  93. # The ID of the GPU that 'make runtest' will use to run unit tests.
  94. TEST_GPUID := 0
  95. # enable pretty build (comment to see full commands)
  96. Q ?= @

5)编译caffe-master!!!"-j4"是使用CPU的多核进行编译,可以极大地加速编译的速度,建议使用。

注:下面的make命令适当的时候加上sudo,建议都已super do来运行。

  1. $ make all -j4
  2. $ make test -j4
  3. $ make runtest -j4

期间会遇到下面的问题:

问题:mkl_alternate.hpp:14:19 fatal error: cblas.h: 没有那个文件或目录

解决:https://github.com/BVLC/caffe/issues/3599

  1. sudo apt-get install libopenblas-dev

问题:找不到 -lablas、-latlas

解决:

  1. sudo apt-get install libatlas-base-dev

可能问题:.build_release/lib/libcaffe.so.1.0.0 Error 1 /usr/bin/ld: 找不到 -lopencv_imgcodecs

解决:你没有安装好CV3,可选择加上b的井号,或参考

https://my.oschina.net/peterlie/blog/661994

http://blog.csdn.net/foolsnowman/article/details/50532226

问题:caffe libcudart.so.8.0 cannot open shared object file no such file or directory

解决:https://github.com/NVIDIA/DIGITS/issues/8

  1. sudo ldconfig /usr/local/cuda/lib64

问题:nvcc warring: the 'compute_20', 'sm_20', and 'sm_21'

解决:我是不理会,不影响使用,想看一眼的可参考以下网址:

http://www.itwendao.com/article/detail/214390.html

6)编译Python和Matlab用到的caffe文件

  1. $ make pycaffe -j4

7)测试

打开example -> MNIST -> Readme.md

按照最前面,cd到Caffe根目录,运行第一页的两个命令,进行下载和格式转换(不超过30MB的下载量)

再运行最下面的命令,Training,看命令行盖楼。。。

五、安装faster-r-cnn参考

bit_hammer大神:

http://blog.csdn.net/u011635764/article/details/52831167

cuDNN v5、v5.1的问题

http://blog.csdn.net/u010733679/article/details/52221404

大家按照bit_hammer大神的步骤安装就好,关于cuDNN v5.1的处理,两篇文章都一样的。

注:faster-r-cnn一定要从Git Clone,Download ZIP不全。

六、测试faster-r-cnn

从百度云盘下载训练好的模型:

VGG16_faster_rcnn_final.caffemodel (548.3MB)

2F_faster_rcnn_final.caffemodel (237.2MB)

将上述两个文件存放于:

py-faster-rcnn/data/faster_rcnn_models/

下,即可运行步骤五中的Demo。

转自http://blog.csdn.net/dylll321/article/details/72784159

Ubuntu16.04+Cuda8.0+1080ti+caffe+免OpenCV3.2.0+faster-rCNN教程的更多相关文章

  1. Ubuntu16.04+CUDA8.0+CUNN5.1+caffe+tensorflow+Theano

    title: Ubuntu 16.04+CUDA8.0+CUNN5.1+caffe+tensorflow+Theano categories: 深度学习 tags: [深度学习框架搭建] --- 前言 ...

  2. Ubuntu16.04+CUDA8.0+cuDNN5.1+Python2.7+TensorFlow1.2.0环境搭建

    软件版本说明:我选的Linux系统是Ubuntu16.04,CUDA用的8.0,Ubuntu16.04+CUDA8.0+cuDNN5.1+Python2.7只支持TensorFlow1.3.0以下的版 ...

  3. 在CUDA8.0下编译安装OpenCV3.1.0来实现GPU加速(Compiling OpenCV3.1.0 with CUDA8.0 support)

    在CUDA8.0下编译安装OpenCV3.1.0 一.本人电脑配置:ubuntu 14.04, NVIDIA GTX1060. 二.编译OpenCV3.1.0前,读者需要成功安装CUDA8.0(网上有 ...

  4. Ubuntu16.04+cuda8.0rc+opencv3.1.0+caffe+Theano+torch7搭建教程

    https://blog.csdn.net/jywowaa/article/details/52263711 学习中用到深度学习的框架,需要搭建caffe.theano和torch框架.经过一个月的不 ...

  5. Ubuntu16.04 +cuda8.0+cudnn+caffe+theano+tensorflow配置明细

      本文为原创作品,未经本人同意,禁止转载,禁止用于商业用途!本人对博客使用拥有最终解释权 欢迎关注我的博客:http://blog.csdn.net/hit2015spring和http://www ...

  6. ubuntu16.04+cuda8.0+cudnn5.0+caffe

    ubuntu安装过程(硬盘安装)http://www.cnblogs.com/zhbzz2007/p/5493395.html“但是千万不要用麒麟版!!!比原版体验要差很多!!!”开关机的时候电脑最上 ...

  7. ubuntu16.04+cuda8.0+caffe

    =========== 如果出现nvidia-smi failed to communicate with nvidia driver,循环登录情况,则: sudo apt-get remove -- ...

  8. 配置YOLO2(ubuntu16.04+cuda8.0+opencv3.1.0)

    要求已经安装好了CUDA 8.0 以及OpenCV3.1.0 YOLO官方网站 配置darknet git clone https://github.com/pjreddie/darknet cd d ...

  9. Ubuntu16.04 + cuda8.0 + GTX1080安装教程

    1. 安装Ubuntu16.04 不考虑双系统,直接安装 Ubuntu16.04,从 ubuntu官方 下载64位版本: ubuntu-16.04-desktop-amd64.iso . 在MAC下制 ...

随机推荐

  1. Java开发工程师(Web方向) - 02.Servlet技术 - 期末考试

    Servlet课程考试 Servlet课程考试 Servlet课程考试 总分:55分 限定时间:120分钟 进入考试 答案已成功提交!请耐心等待成绩公布 Servlet课程考试: 1(12分) 简单谈 ...

  2. 几个常见移动平台浏览器的User-Agent

    之前介绍的手机站跳转url的一片文稿中提到,依据User Agent判断终端的方法.(文章地址:http://www.cnblogs.com/dereksunok/p/3664169.html ) 若 ...

  3. LeetCode - 442. Find All Duplicates in an Array - 几种不同思路 - (C++)

    题目 题目链接 Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and ...

  4. #pragma pack(n)对齐格式

    #pragma pack(n)对齐格式 #pragma pack(n) 是预处理器用来指定对齐格式的指令,表示n对齐.当元素字节小于n时,要扩展到n:若元素字节大于n则占用其实际大小. struct ...

  5. POJ 2826 An Easy Problem?!(线段交点+简单计算)

    Description It's raining outside. Farmer Johnson's bull Ben wants some rain to water his flowers. Be ...

  6. wpa_supplicant下行接口浅析

    wpa_supplicant通过socket通信机制实现下行接口,与内核进行通信,获取信息或下发命令. 以下摘自http://blog.csdn.net/fxfzz/article/details/6 ...

  7. 如何在html中把一个图片或者表格覆盖在一张已有图片上的任意位置

    如何在html中把一个图片或者表格覆盖在一张已有图片上的任意位置   <div style="position:relative;"> <img src=&quo ...

  8. opencart

    1. Deleting english language, what happens?   Disable English tab , category and products     1) Fir ...

  9. TCP系列36—窗口管理&流控—10、linux下的异常报文系列接收

    在这篇文章中我们看一下server端在接收到异常数据系列时的处理,主要目的是通过wireshark示例对这些异常数据系列的处理有一个直观的认识,感兴趣的自行阅读相关代码和协议,这里不再进行详细介绍 在 ...

  10. VS2013 “未找到与约束 ContractName Microsoft.Internal.VisualStudio.PlatformUI.ISolutionAttachedCollectionService RequiredTypeIdentity Microsoft.Internal.VisualStudio.PlatformUI.ISolutionAttachedCollectionService 匹配的导出”

    下面是我出错误的附加图片 这个错误导致无法打开项目. 解决方法: 解: C:\Users\Administrator\AppData\Local\Microsoft\VisualStudio\12.0 ...