This Guide is based on caffe github wiki guide (https://github.com/BVLC/caffe/wiki/Ubuntu-16.04-or-15.10-Installation-Guide )

Some parts of it have been changed to suit my own computer.

  

The following guide includes the how-to instructions for the installation of BVLC/Caffe in Ubuntu 16.04 (preliminary procedure does not function with the current Cuda Toolkit) or 15.10 Linux (works well). This also includes the KUbuntu 16.04 or 15.10 and the related distributions.

Execute these commands first:

sudo apt-get update

sudo apt-get upgrade

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

# (Python general)
sudo apt-get install -y python-pip # (Python 2.7 development files)
sudo apt-get install -y python-dev
sudo apt-get install -y python-numpy python-scipy I didn't try python 3.5 to avoid a version confilct problem, and I also didn't use opencv 3.1 for the same reason.
I just want to make it simple and function well.
# (OpenCV 2.4)
sudo apt-get install -y libopencv-dev

Go to the https://github.com/BVLC/caffe and download zip archive. Unpack it to ~/bin/ or any other location. Enter the caffe-master directory in the terminal window.

Copy the Makefile.config.example to Makefile.config like this:

cp Makefile.config.example Makefile.config

and open it for editing (with a text editor). I use the kate editor for this purpose, so the command that I execute goes as follows. You first need to install the kate editor with:

sudo apt-get install kate

and then you can edit the configuration file with:

kate ./Makefile.config &

The following line in the configuration file tells the program to use CPU only for the computations.

CPU_ONLY := 1

This is the typical setting for a computer without any NVIDIA graphics card and it is typical for the installation of Caffe inside the typical virtual machine. (Notice that there is a special type of virtual machine inside the Ubuntu host machine that can access the physical NVIDIA graphics card directly. See https://github.com/NVIDIA/nvidia-docker)

Change the line accordingly by commenting it out (# CPU_ONLY := 1) if you have an NVIDIA graphics card with the proprietary driver, CUDA toolkit and CUDNN installed. The Makefile.config should contain the following lines, so find them and fill them in.

PYTHON_INCLUDE := /usr/include/python2.7 /usr/lib/python2.7/dist-packages/numpy/core/include

(For ways to create an isolated Python environment, explore the topic of virtual environments here: http://docs.python-guide.org/en/latest/dev/virtualenvs/)

WITH_PYTHON_LAYER := 1

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

Now lets continue with the instructions for version 15.10 first, followed by instructions for 16.04 users.

Execute the additional commands:

find . -type f -exec sed -i -e 's^"hdf5.h"^"hdf5/serial/hdf5.h"^g' -e 's^"hdf5_hl.h"^"hdf5/serial/hdf5_hl.h"^g' '{}' \;

cd /usr/lib/x86_64-linux-gnu

sudo ln -s libhdf5_serial.so.8.0.2 libhdf5.so

sudo ln -s libhdf5_serial_hl.so.8.0.2 libhdf5_hl.so

The above commands will need to be executed for Ubuntu 16.04 as well, but the file versions for libhdf5_serial.so and libhdf5_serial_h1.so are different and so the last two lines will need to be altered. Visit /usr/lib/x86_64-linux-gnu/ and list the relevant contents of that directory using a command

  such as ls | grep hdf5

The versions of libhdf5 that need to be linked to are 10.1.0 and 10.0.2 respectively.

So, for Ubuntu16.04, execute the additional commands like this:

  find . -type f -exec sed -i -e 's^"hdf5.h"^"hdf5/serial/hdf5.h"^g' -e 's^"hdf5_hl.h"^"hdf5/serial/hdf5_hl.h"^g' '{}' \;

  cd /usr/lib/x86_64-linux-gnu

  such as ls | grep hdf5

  sudo ln -s libhdf5_serial.so.10.1.0 libhdf5.so

  sudo ln -s libhdf5_serial_hl.so.10.0.2 libhdf5_hl.so

     

Now for both platforms lets return to the unpacked Caffe directory caffe-master and enter these commands:

cd python

for req in $(cat requirements.txt); do pip install $req; done

NOTE: If the Ubuntu operating system was updated, perhaps the Python layer needs to be updated and recompiled, because the Python module no longer works. Perform this step again in that case.

for req in $(cat requirements.txt); do pip install $req; done

In case of any problems, try:

for req in $(cat requirements.txt); do sudo -H pip install $req --upgrade; done

The build process will fail in Ubuntu 16.05 due to the GCC 5.x compiler, when compiling Cuda 7.5 sources. The updated version of Cuda Toolkit 8.0RC is compatible with GCC 5.x compiler in Ubuntu 16.05. Once Cuda Toolkit 8.0RC is installed, Caffe will successfully build and run in Ubuntu 16.05.

In any case, the next step is to execute the following code to build Caffe:

cd ..

(now you are in caffe-master directory)

make all

make test

make runtest

make pycaffe      -should be finished already, so you can omit this one

make distribute

Note that the build process can be sped up by appending -j $(($(nproc) + 1)) to the above commands, which distributes the build across the available processors on your system. For example:

make all

can become

make all -j $(($(nproc) + 1))

In order to make the Python work with Caffe, open the file ~/.bashrc for editing in your favorite text editor. There, add the following line at the end of file:

export PYTHONPATH=/path/to/caffe-master/python:$PYTHONPATH

You can also execute that same line immediately as a command for immediate effects.

 

caffe + ubuntu16.04 (version without GPU)的更多相关文章

  1. 深度学习caffe:Ubuntu16.04安装指南(1)

    caffe [CPU ONLY] 2017-01-15 最简单的安装配置方式: 不用GPU加速,使用OPENCV2.4图像库, 这是根据官方教程(链接如下)简化而得到. Ubuntu 16.04 or ...

  2. Caffe Ubuntu16.04 GPU安装

  3. ubuntu16.04+cuda8.0+gpu

    安装完ubuntu系统之后,在学校的环境下,联网需要安装mentohust. 参考: http://www.cnblogs.com/alexanderkun/p/6905604.html http:/ ...

  4. 通过Anaconda在Ubuntu16.04上安装 TensorFlow(GPU版本)

    一. 安装环境 Ubuntu16.04.3 LST GPU: GeForce GTX1070 Python: 3.5 CUDA Toolkit 8.0 GA1 (Sept 2016) cuDNN v6 ...

  5. Ubuntu16.04.1安装Caffe(GPU)

    Caffe的优势: 1.上手快:模型与相应优化均以文本形式而非代码形式给出,caffe给出了模型的定义,最优化设置以及预训练的权重 2.速度快:与CuDNN结合使用,测试AlexNet模型,在K40上 ...

  6. Ubuntu16.04 faster-rcnn+caffe+gpu运行环境配置以及解决各种bug

    https://blog.csdn.net/flygeda/article/details/78638824 本文主要是对近期参考的网上各位大神的博客的总结,其中,从安装系统到跑通程序过程中遇到的各种 ...

  7. Ubuntu16.04安装配置Caffe教程(GPU版)

    推荐博客:https://www.linuxidc.com/Linux/2017-11/148629.htmhttps://blog.csdn.net/yggaoeecs/article/detail ...

  8. ubuntu16.04 + caffe + SSD + gpu 安装

    昨天我们买好了硬件,今天我们开始安装caffe了,我本人安装过caffe不下10次,每次都是一大堆问题,后来终于总结了关键要点,就是操作系统. 1. 千万不要用ubuntu17.10来安装, 2. 最 ...

  9. ubuntu16.04下配置caffe无GPU

    1. 安装依赖项  1 sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5- ...

随机推荐

  1. 使用mybatis-generator自动生成映射配置

    使用mybatis时,编写实体类与数据库的映射是一项繁琐的工作,很容易出错,而mybatis-generator工具很好地解决了这个问题. 一.工具下载与配置  下载地址:① https://gith ...

  2. 使用Microsoft Fakes隔离测试代码

    在单元测试(Unit Test)中我们遇到的问题之一是:假如被测试组件(类或项目)为A,组件A依赖于组件B,那么在组件A的单元测试ATest中测试A时,也需要依赖于B,在B发生改动后,就可能影响到A的 ...

  3. AppSettings和connectionStrings的却别(转)

    AppSettings是ASP.NET1.1时期用的,在.NET Framework 2.0中,新增了ConnectionStrings. 1.<connectionStrings> &l ...

  4. 【小窍门】cmd控制台无法输入中文(日文),输出非英文字符都是问号解决办法,中文都是问号解决办法

    在网上复制了一段代码,里面含有中文,而自己电脑本身系统是英文 win8/win10, 在VS 里debug之后输出后,中文都是问号.并不是乱码什么的. 奇怪了. 打开cmd,输入日文的时候,显示IME ...

  5. [Spring常见问题]java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

    这个问题是因为部署在tomcat下的项目中没有springweb包 但是问题来了,但是我的项目中有呀,maven都引了呀,然后我就懵B啦!看到这个博客我就豁然开朗了:http://my.oschina ...

  6. 自己写的jquery 弹框插件

    html部分 <!DOCTYPE html> <html> <head lang="en"> <meta charset="UT ...

  7. struts 国际化

    国际化 1. 国际化与本地化 国际化 (Internationalization: I18N): 是程序在不做任何修改的情况下,就可以再不同的国家或地区和不同的语言环境下,按照当地的语言和格式习惯显示 ...

  8. Foundation框架

    1.框架是由许多类.方法.函数.文档按照一定的逻辑组织起来的集合,以便使研发程序变的更容易 清除缓存,删除这个文件夹下的所有文件/Users/fanyafang/Library/Developer/X ...

  9. Xubuntu VNC Xfce4

    sudo mousepad ~/.vnc/xstartup #!/bin/sh # Uncomment the following two lines for normal desktop: unse ...

  10. jQuery入门教程

    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,博客地址为http://www.cnblogs.com/jasonnode/ .网站上有对应每一 ...