this part records the process of installing opencv and caffe on ubuntu 16.04 with gtx1080 gpu.

  • Installing ubuntu16.04
    since we didn’t succeed in installing ubuntu14.04 on this server,so we installed the ubuntu16.04.
  • Installing the nvidia driver
    • check what driver should we install sudo ubuntu-drivers devices
    • add the repository sudo add-apt-repository ppa:graphics-drivers
    • install driver (change the driver num according to your own server)

      sudo apt-get update
      sudo apt-get install nvidia-367 mesa-common-dev freeglut3-dev

    • reboot to effect the driver
    • test the driver by nvidia-smi
  • Installing cuda8.0

    • download the cuda8.0 from the NVIDIA official website,recommend the run file instead of deb
    • install the cuda,e.g. sh cuda_8.0.27_linux.run,notice that:
      • DON’T INSTALL THE DRIVER IN THE RUN FILE,it will overide the driver we installed just Now.
      • DON’T INSTALL THE OPENGL LIB,you cannot log in even with the correct password.
    • add the cuda/bin and lib to the PATH AND PROFILE

      sudo vim /etc/profile
      export PATH=/usr/local/cuda/bin:$PATH

      sudo vim /etc/ld.so.conf.d/cuda.conf
      /usr/local/cuda/lib64

    • test the example in ~/NVIDIA *. note that the gcc/g++ version in ubuntu 16.04 is >=5.3,maybe cause some errors,so we modified the /usr/local/cuda/include/host_config.h to support 5.3 version gcc/g++.

      sudo vim /usr/local/cuda/include/host_config.h
      find the if _GNUC_ > 5,change the 5 to 6
      cd ~/Nvidia(tab)
      make -j16
      cd bin/…/
      ./deviceQuery

    if you get the pass result,install corectly.

  • Installing Opencv3.0
    there are two things we need to pay attention to in installing opencv3.0:

    • build opencv without rebuilding the tiff lib
    • modified src file to support cuda8.0

    Installing steps are summarized below:

    • download the installing shell script from private cloud disk(code: wysa)
    • install dependencies sudo sh dependencies.sh
    • run the opencv3_0_0.sh to get src file sudo sh opencv3_0_0.sh,note that maybe we will stop at the downloading ippcv,we can pre-download this file from here and put it in OpenCV-master/3rdparty/ippicv/downloads/Linux-xxxx/
    • since in ubuntu16.04,the libtiff version is 5,not 4. so we need to modified the opencv3_0_0.sh to ignore the installation of libtiff4-dev as follows. simply delete the libtiff4-dev and add -D WITH_TIFF=ON in cmake command

    original opencv3_0_0.sh

    arch=$(uname -m)
    if [ "$arch" == "i686" -o "$arch" == "i386" -o "$arch" == "i486" -o "$arch" == "i586" ]; then
    flag=1
    else
    flag=0
    fi
    echo "Installing OpenCV 3.0.0"
    mkdir OpenCV
    cd OpenCV
    echo "Removing any pre-installed ffmpeg and x264"
    sudo apt-get -y remove ffmpeg x264 libx264-dev
    echo "Installing Dependenices"
    sudo apt-get -y install libopencv-dev
    sudo apt-get -y install build-essential checkinstall cmake pkg-config yasm
    sudo apt-get -y install libtiff4-dev libjpeg-dev libjasper-dev
    sudo apt-get -y install libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev
    sudo apt-get -y install python-dev python-numpy
    sudo apt-get -y install libtbb-dev
    sudo apt-get -y install libqt4-dev libgtk2.0-dev
    sudo apt-get -y install libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev
    sudo apt-get -y install x264 v4l-utils ffmpeg
    sudo apt-get -y install libgtk2.0-dev
    echo "Downloading OpenCV 3.0.0"
    wget -O opencv-3.0.0.zip http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/3.0.0/opencv-3.0.0.zip/download
    echo "Installing OpenCV 3.0.0"
    unzip opencv-3.0.0.zip
    cd opencv-3.0.0
    mkdir build
    cd build
    cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON ..
    make -j4
    sudo make install
    sudo sh -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf'
    sudo ldconfig
    echo "OpenCV 3.0.0 ready to be used"

    modified opencv3_0_0.sh

    arch=$(uname -m)
    if [ "$arch" == "i686" -o "$arch" == "i386" -o "$arch" == "i486" -o "$arch" == "i586" ]; then
    flag=1
    else
    flag=0
    fi
    echo "Installing OpenCV 3.0.0"
    mkdir OpenCV
    cd OpenCV
    echo "Removing any pre-installed ffmpeg and x264"
    sudo apt-get -y remove ffmpeg x264 libx264-dev
    echo "Installing Dependenices"
    sudo apt-get -y install libopencv-dev
    sudo apt-get -y install build-essential checkinstall cmake pkg-config yasm
    sudo apt-get -y install libjpeg-dev libjasper-dev
    sudo apt-get -y install libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev
    sudo apt-get -y install python-dev python-numpy
    sudo apt-get -y install libtbb-dev
    sudo apt-get -y install libqt4-dev libgtk2.0-dev
    sudo apt-get -y install libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev
    sudo apt-get -y install x264 v4l-utils ffmpeg
    sudo apt-get -y install libgtk2.0-dev
    echo "Downloading OpenCV 3.0.0"
    wget -O opencv-3.0.0.zip http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/3.0.0/opencv-3.0.0.zip/download
    echo "Installing OpenCV 3.0.0"
    unzip opencv-3.0.0.zip
    cd opencv-3.0.0
    mkdir build
    cd build
    cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON -D WITH_TIFF=ON ..
    make -j4
    sudo make install
    sudo sh -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf'
    sudo ldconfig
    echo "OpenCV 3.0.0 ready to be used"
    • modified the graphcuts.cpp to support cuda8.0
  • Installing cudnn
    Installing the cudnn v5 for cuda8.0

    tar xvzf cudnn-8.0-linux-x64-v5.0-ga.tgz
    sudo cp cuda/include/cudnn.h /usr/local/cuda/include
    sudo cp cuda/lib64/. /usr/local/cuda/lib64
    sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*
    cd /usr/local/cuda/lib64/
    sudo rm -rf libcudnn.so libcudnn.so.5
    sudo ln -s libcudnn.so.5.1.5 libcudnn.so.5
    sudo ln -s libcudnn.so.5 libcudnn.so
    sudo ldconfig

  • Installing additionale package

package name command
python-tk sudo apt-get install python-tk
  • Installing caffe (using python2.7 not anaconda,otherwise maybe cause conflict between anaconda and system python)

    • Basic dependience

      sudo apt-get update
      sudo apt-get install -y build-essential cmake git pkg-config
      sudo apt-get install -y libprotobuf-dev libleveldb-dev libsnappy-dev libhdf5-serial-dev protobuf-compiler
      sudo apt-get install -y libatlas-base-dev
      sudo apt-get install -y –no-install-recommends libboost-all-dev sudo apt-get install -y libgflags-dev libgoogle-glog-dev liblmdb-dev
      sudo apt-get install -y python-pip python-dev python-numpy python-scipy # (Python general)
      sudo apt-get install libopencv-dev

    • git clone caffe and install python dependience

      git clone https://github.com/BVLC/caffe.git
      cd caffe-master/python
      for req in $(cat requirements.txt); do pip install $req; done

    note which package isn’t installed correctly,re-install it.

    • modified 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 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 := 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)/anaconda
# 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 \
               /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

# 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 ?= @
  • compile and test

    cd ~/caffe-master
    make all -j16
    make test -j16
    make runtest -j16
    make pycaffe

  • test pycaffe

    export PYTHONPATH=~/caffe-master/python:$PYTHONPATH
    in python,import caffe

if no error occurs,we install caffe correctly

echo ‘export PYTHONPATH=~/caffe-master/python’ >> ~/.bashrc

  • Installing SSD
    most part is the same as compiling caffe,record the process as below.

    • git clone SSD (in home directory)

      git clone https://github.com/weiliu89/caffe.git
      cd caffe
      git checkout ssd

    • modified the Makefile.config file (same as caffe’s Makefile.config,so we just copy it here)

      cp ~/caffe-master/Makefile.config ~/caffe/

    • compile and test

      cd ~/caffe
      mkdir build
      cd build
      cmake ..
      make all -j16
      make install
      make runtest
      make pycaffe

  • ROS-Kinetic

  • Reference:
    Ubuntu16.04 + cuda8.0 + GTX1080 + matlab14.04a + Opencv3.0 + caffe 安装教程
    GTX1070+CUDA8.0+Ubuntu16.04+Caffe+SSD 深度学习框架搭建 细节一步到位版
    SSD的配置安装与测试

Ubuntu 16.04 + Opencv3.0 + gtx1080 + caffe(SSD) + ROS(Kinetic)的更多相关文章

  1. ios – 如何使用Objective C类中的多个参数调用Swift函数?

    本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请发送邮件至dio@foxmail.com举报,一经查实,本站将立刻删除。

  2. ios – Swift 4添加手势:覆盖vs @objc

    我想在我的视图中添加一个手势,如下所示:但是,在Swift4中,我的编译器给出了以下错误:建议添加@objc以将此实例方法公开给Objective-C.实现此目的的另一个选项将覆盖touchesBegan()函数并使用它来处理点击.我试图以“Swift”的方式做到这一点,而不必带入Obj-C.有没有纯粹的Swift方式来添加这个轻击手势而不使用@objc?

  3. ios – 将视频分享到Facebook

    我正在编写一个简单的测试应用程序,用于将视频从iOS上传到Facebook.由于FacebookSDK的所有文档都在Objective-C中,因此我发现很难在线找到有关如何使用Swift执行此操作的示例/教程.到目前为止我有这个在我的UI上放置一个共享按钮,但它看起来已禁用,从我读到的这是因为没有内容设置,但我看不出这是怎么可能的.我的getVideoURL()函数返回一个NSURL,它肯定包含视

  4. ios – 以编程方式在Swift中添加联系人

    我想在Swift中以编程方式添加联系人.我发现了一些Objective-C示例,但我没有让它们工作,甚至在Objective-C中也没有.我不希望这涉及到AddressBookUI,因为我想从我自己的UI中获取值.解决方法这是在Swift中添加联系人的快速方法.我在我的iPhone5iOS7.1上验证了它,因为我发现模拟器并不总是与我的手机对AB的东西相同.您可以添加一个按钮并指向此方法:顺便说一下–它假设你已经分配了一个地址簿var,你可以通过覆盖viewDidAppear来打开视图.它也会执行安全提示

  5. ios – 为目标c中的方法传递未知类型的参数,可能吗?

    是否可以将未知类型的参数传递给objective-C方法?在C#中你可以写实现这一点,但我知道Objective-C没有泛型,所以有没有其他方法可以在Objective-C中实现这一点?我需要这个,因为我想创建一个方法来改变不同对象的文本颜色,如UITextField和UIButton的占位符文本.所以我的计划是创建一个名为textWhite的方法,然后在此方法中检查对象的类型,然后运行匹配的代码以使文本颜色变为白色.解决方法是的,可以传递未知类型的参数.见下面的例子.请参考使用id对象的链接作为参数Us

  6. ios – Swift指针算术和解除引用;将一些类似C的地图代码转换为Swift

    我有一点似乎没有工作的Swift代码……解决方法您正在指定locationPointer指向新位置,但仍在下一行中使用ptr,并且ptr的值尚未更改.将您的最后一行更改为:或者你可以改变指向var的指针并推进它:

  7. xamarin.ios – ShareKit与MonoTouch如何?

    有人可以验证ShareKit实际上是否可用于MonoTouch并指导我完成使其工作所需的步骤?解决方法您首先从getsharekit.com下载还是使用ShareKit2.0?

  8. ios – “禁用模块时使用’@import’”错误 – 启用模块和链接框架= YES

    我有一个使用CocoaPods并使用’SCLAlertView-Objective-C’窗格的项目.该pod使用@importUIKit;模块样式导入.我在目标和项目设置中将“启用模块(C&Objective-C)”和“自动链接框架”设置为YES.当模块被禁用时,我仍然得到“使用’@import’错误.有没有什么可以阻止Xcode能够启用模块,如使用.pch文件,任何链接器标志,或者我没有提到的任

  9. ios8 – iOS 8上的ptrace

    我试图在ptrace上调用一个像thisptrace一样的函数;但是当我尝试使用#include导入它时,Xcode会给我一个错误’sys/ptrace.h’文件找不到.我错过了什么,我是否需要导入一个库,或者这在iOS上根本不可用?

  10. XCode 6.3立即在抛出的Objective-C异常上引发SIGABRT

    考虑以下目标-C代码在XCode6.2中,它按预期工作(记录“错误消息”).但是,由于我们升级到6.3,抛出行(throwstd::logic_error…)引发SIGABRT(堆栈跟踪仅包含_cxa_throw和_pthread_kill,超出applicationdidFinishLaunchingWithOptions)并导致应用程序崩溃.这只发生在我们的应用程序中–当我将完全相同的代码复制

随机推荐

  1. crontab发送一个月份的电子邮件

    ubuntu14.04邮件服务器:Postfixroot收到来自crontab的十几封电子邮件.这些邮件包含PHP警告.>我已经解决了这些警告的原因.>我已修复每个cronjobs不发送电子邮件(输出发送到>/dev/null2>&1)>我删除了之前的所有电子邮件/var/mail/root/var/spool/mail/root但我仍然每小时收到十几封电子邮件.这些电子邮件来自cronjobs,

  2. 模拟两个ubuntu服务器计算机之间的慢速连接

    我想模拟以下场景:假设我有4台ubuntu服务器机器A,B,C和D.我想在机器A和机器C之间减少20%的网络带宽,在A和B之间减少10%.使用网络模拟/限制工具来做到这一点?

  3. ubuntu-12.04 – 如何在ubuntu 12.04中卸载从源安装的redis?

    我从源代码在Ubuntu12.04上安装了redis-server.但在某些时候它无法完全安装,最后一次makeinstallcmd失败.然后我刚刚通过apt包安装.现在我很困惑哪个安装正在运行哪个conf文件?实际上我想卸载/删除通过源安装的所有内容,只是想安装一个包.转到源代码树并尝试以下命令:如果这不起作用,您可以列出软件自行安装所需的步骤:

  4. ubuntu – “apt-get source”无法找到包但“apt-get install”和“apt-get cache”可以找到它

    我正在尝试下载软件包的源代码,但是当我运行时它无法找到.但是当我运行apt-cache搜索squid3时,它会找到它.它也适用于apt-getinstallsquid3.我使用的是Ubuntu11.04服务器,这是我的/etc/apt/sources.list我已经多次更新了.我尝试了很多不同的debs,并没有发现任何其他地方的错误.这里的问题是你的二进制包(deb)与你的源包(deb-src)不

  5. ubuntu – 有没有办法检测nginx何时完成正常关闭?

    &&touchrestarted),因为即使Nginx没有完成其关闭,touch命令也会立即执行.有没有好办法呢?这样的事情怎么样?因此,pgrep将查找任何Nginx进程,而while循环将让它坐在那里直到它们全部消失.你可以改变一些有用的东西,比如睡1;/etc/init.d/Nginx停止,以便它会休眠一秒钟,然后尝试使用init.d脚本停止Nginx.你也可以在某处放置一个计数器,这样你就可以在需要太长时间时发出轰击信号.

  6. ubuntu – 如何将所有外发电子邮件从postfix重定向到单个地址进行测试

    我正在为基于Web的应用程序设置测试服务器,该应用程序发送一些电子邮件通知.有时候测试是使用真实的客户数据进行的,因此我需要保证服务器在我们测试时无法向真实客户发送电子邮件.我想要的是配置postfix,以便它接收任何外发电子邮件并将其重定向到一个电子邮件地址,而不是传递到真正的目的地.我正在运行ubuntu服务器9.10.先感谢您设置本地用户以接收所有被困邮件:你需要在main.cf中添加:然后

  7. ubuntu – vagrant无法连接到虚拟框

    当我使用基本的Vagrantfile,只配置了两条线:我看到我的虚拟框打开,但是我的流氓日志多次显示此行直到超时:然后,超时后的一段时间,虚拟框框终于要求我登录,但是太久了!所以我用流氓/流氓记录.然后在我的物理机器上,如果我“流氓ssh”.没有事情发生,直到:怎么了?

  8. ubuntu – Nginx – 转发HTTP AUTH – 用户?

    我和Nginx和Jenkins有些麻烦.我尝试使用Nginx作为Jenkins实例的反向代理,使用HTTP基本身份验证.它到目前为止工作,但我不知道如何传递带有AUTH用户名的标头?}尝试将此指令添加到您的位置块

  9. Debian / Ubuntu – 删除后如何恢复/ var / cache / apt结构?

    我在ubuntu服务器上的空间不足,所以我做了这个命令以节省空间但是现在在尝试使用apt时,我会收到以下错误:等等显然我删除了一些目录结构.有没有办法做apt-getrebuild-var-tree或类似的?

  10. 检查ubuntu上安装的rubygems版本?

    如何查看我的ubuntu盒子上安装的rubygems版本?只是一个想法,列出已安装的软件包和grep为ruby或宝石或其他:)dpkg–get-selections

返回
顶部