SSD是Caffe的一个分支,源码在github上:https://github.com/weiliu89/caffe/tree/ssd

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

然后编译SSD

$ cp Makefile.config.example Makefile.config
$ make -j8
$ make py
$ make test -j8

在这个过程中会遇到很多很多问题,特此记录

1、hdf5缺失

解决方案

官网下载hdf5:https://www.hdfgroup.org/downloads/hdf5/source-code/

解压后编译安装

$ cd hdf5-1.10.3
$ mkdir build
$ cd build
$ cmake ..
$ sudo make
$ sudo make install

对于新版本的hdf5需要较新版本的cmake,因此需要将cmake更新至3.10以后,此处选择3.12.0

$ cd /usr
$ sudo wget https://cmake.org/files/v3.12/cmake-3.12.0-Linux-x86_64.tar.gz
$ sudo tar zxvf cmake-3.12.0-Linux-x86_64.tar.gz
$ sudo ln -s /usr/cmake-3.12.0-Linux-x86_64/bin/* /usr/bin/

如果提示有冲突,那么需要将原有的cmake相关可执行文件删除

$ sudo rm /usr/bin/cmake #以及其他如ccmake、ctest、cpack、cmake-gui
#然后重新关联
$ sudo ln -s /usr/cmake-3.12.0-Linux-x86_64/bin/* /usr/bin/
$ cmake --version #检查cmake版本,如果为3.12.0则说明安装成功

打开Makefile.config,找到

# Whatever else you find you need goes here.
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib

改为

# 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

然后链接hdf5库

$ cd /usr/lib/x86_64-linux-gnu
$ sudo ln -s libhdf5_serial.so.10.0.2 libhdf5.so
$ sudo ln -s libhdf5_serial_hl.so.10.0.2 libhdf5_hl.so

如果还是有问题

$ sudo ln -sf libhdf5_serial.so libhdf5.so
$ sudo ln -sf libhdf5_serial_hl.so libhdf5_hl.so

github上有讨论帖https://github.com/BVLC/caffe/issues/4333

2、opencv3的问题

问题如下

.build_release/lib/libcaffe.so: undefined reference to 'cv::VideoCapture::set(int, double)'
...

解决方案

已安装opencv3及对应的contrib的同学们打开Makefile.config,找到

# OPENCV_VERSION := 3

将这句话前面的#去掉,然后打开Makefile找到

ifeq ($(USE_OPENCV), 1)
LIBRARIES += opencv_core opencv_highgui opencv_imgproc

这里空格然后加上

opencv_imgcodecs opencv_contrib opencv_videoio

3、架构architecture compute_20的问题

问题如下

nvcc fatal   : Unsupported gpu architecture 'compute_20'
Makefile:596: recipe for target '.build_release/cuda/src/caffe/solvers/nesterov_solver.o' failed

解决方案

打开Makefile.config,找到

# CUDA architecture setting: going with all of them.
# For CUDA <.0, comment the lines after *_35 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_61,code=sm_61

第三行和第四行中的结构部分前面加#,改为

# CUDA architecture setting: going with all of them.
# For CUDA <.0, comment the lines after *_35 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_61,code=sm_61

至此基本解决安装编译SSD的问题,接下来从github上下载MobileNet到examples文件夹下:https://github.com/chuanqi305/MobileNet-SSD,运行demo.py,这时又会出现好几种问题,特做以下记录

4、没有安装pycaffe

问题如下

ImportError: No module named _caffe

这是没有配置好python与caffe的接口,需要安装pycaffe

解决方案

$ cd your_caffe_path
$ sudo make pycaffe

5、找不到skimage模块

问题如下

ImportError: No module named skimage.io

找不到skimage模块,那么我们安装此模块

解决方案

$ sudo pip install scikit-image

使用pip安装的过程中,如果pip版本过低,有些库是无法安装的,因此需要用以下的命令升级到最新版的pip

$ sudo pip install --upgrade pip

建议个人使用pip时安装都加上sudo,有些文件权限会有问题。

6、找不到protobuf模块

问题如下

ImportError: No module named google.protobuf.internal

找不到protobuf模块,解决方案类似于上一问题

解决方案

$ sudo pip install protobuf

[环境配置]Ubuntu 16.04+CUDA 9.0+OpenCV 3.2.0下编译基于Caffe的MobileNet-SSD踩过的一些坑的更多相关文章

  1. [环境配置]Ubuntu 16.04 源码编译安装OpenCV-3.2.0+OpenCV_contrib-3.2.0及产生的问题

    1.OpenCV-3.2.0+OpenCV_contrib-3.2.0编译安装过程 1)下载官方要求的依赖包 GCC 4.4.x or later CMake 2.6 or higher Git GT ...

  2. Ubuntu 16.04 + CUDA 8.0 + cuDNN v5.1 + TensorFlow(GPU support)安装配置详解

    随着图像识别和深度学习领域的迅猛发展,GPU时代即将来临.由于GPU处理深度学习算法的高效性,使得配置一台搭载有GPU的服务器变得尤为必要. 本文主要介绍在Ubuntu 16.04环境下如何配置Ten ...

  3. tensorflow 1.8, ubuntu 16.04, cuda 9.0, nvidia-390,安装踩坑指南。

    被tensorflow 1.8, ubuntu 16.04, cuda 9.0, nvidia-390折磨了5天,终于上坑,留下指南,造福后人. 1.先把依赖搞清楚: tensorflow 1.8依赖 ...

  4. Ubuntu 16.04: How to install OpenCV

    参考:https://www.pyimagesearch.com/2016/10/24/ubuntu-16-04-how-to-install-opencv/ 步骤# 1:安装opencv的依赖项 本 ...

  5. OpenCV - Linux(Ubuntu 16.04)中安装OpenCV + OpenCV_Contrib

    近两个月来接触了Linux系统,在老板的建议下翻了Ubuntu的牌子,我安装的版本是16.04,用习惯之后感觉蛮好的,比Windows要强.好啦,废话不说啦,下面开始说在Ubuntu中安装OpemCV ...

  6. 如何配置Ubuntu 16.04 GRUB 2引导加载程序

    正如你所知,GRUB 2 是大多数 Linux 操作系统的默认引导加载程序.GRUB 是 GRand Unified Bootloader 的缩写,它是 Linux 启动时首先要加载的一个程序,此后它 ...

  7. Ubuntu 16.04: How to resolve libqt5x11extras5 (>= 5.1.0) but it is not going to be installed

    Issue: When you install Virtualbox 5.1 on Ubuntu 16.04, you may encounter following error: root@XIAY ...

  8. 配置ubuntu 16.04.1 LTS odoo 10.0开发环境

    使用VMware Fusion 8.5.0创建ubuntu 64bit虚拟机:使用ubuntu-16.04.1-desktop-amd64.iso镜像缺省安装ubuntu,用户名odoo,密码1234 ...

  9. ubuntu16.04下安装配置深度学习环境(Ubuntu 16.04/16.10+ cuda7.5/8+cudnn4/5+caffe)

    主要参照以下两篇博文:http://blog.csdn.net/g0m3e/article/details/51420565   http://blog.csdn.net/xuzhongxiong/a ...

随机推荐

  1. XtraEditors一、总体介绍

    一.所有编辑器的公共功能 全部都可以绑定数据: 全部都可以独立使用或用于由 Developer Express 提供的容器控件 (XtraGrid.XtraVerticalGrid.XtraTreeL ...

  2. 团队作业1——团队展示&教辅宝

    1.队名:PHILOSOPHER 2.队员学号: [组长]金盛昌(201421122043).刘文钊(20142112255).陈笑林(201421122042). 张俊逸(201421122044) ...

  3. 4698. [SDOI2008]Sandy的卡片【后缀数组】

    Description Sandy和Sue的热衷于收集干脆面中的卡片.然而,Sue收集卡片是因为卡片上漂亮的人物形象,而Sandy则是为了积 攒卡片兑换超炫的人物模型.每一张卡片都由一些数字进行标记, ...

  4. [USACO08NOV]lites

    嘟嘟嘟 竟然还能发现这么水的题.就是线段树维护区间亦或嘛~~~~ #include<cstdio> #include<iostream> #include<algorit ...

  5. React 如何正常渲染一段HTML字符串

    dangerouslySetInnerHTMl 属性 很多时候我们做一个项目接口会返回一段 HTML 字符串文本,然后我们把它解析渲染成正常的html,这是在项目中常见不能再常见的情况了,可是在 re ...

  6. 译:ORCFILE IN HDP 2:更好的压缩,更高的性能

    原文地址: https://hortonworks.com/blog/orcfile-in-hdp-2-better-compression-better-performance/ ORCFILE I ...

  7. linux rpm jdk安装环境配置

    wget   https://download.oracle.com/otn/java/jdk/8u211-b12/478a62b7d4e34b78b671c754eaaf38ab/jdk-8u211 ...

  8. ZOJ 3992 One-Dimensional Maze(思维题)

    L - One-Dimensional Maze Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%lld & % ...

  9. Mysql 安全登陆工具 mysql_config_editor

    mysql_config_editor 帮助信息请查看 man mysql_config_editor 或 mysql_config_editor -? 或 mysql_config_editor s ...

  10. python爬虫-execjs使用

    python爬虫-execjs使用 ecexjs的作用 通过python代码去执行JavaScript代码的库 execjs的安装 pip install PyExecJS execjs使用之前,得先 ...