Deep learning Tools Caffe Detailed Installation Guide

Source: Internet
Author: User

Caffe Installation Guide-vomiting blood finishing

Objective:

It is easy to install Caffe on a Linux machine with a good system environment, but if the system itself is old and there is no GPU, the installation is too cumbersome and all has to be done from scratch, and this document is designed to cover as much of the pit as possible for installation.


Steps:

First, the Caffe is mainly written in C + + and Python. First of all, you need to install gcc,g++, through Yum installation.


Second, CUDA installation, if the machine is configured with the NVIDIA series GPU, you need to install the driver, it is recommended to install the driver to 7.0 version, it is recommended to install CUDNN. Installation can be similar to the reference Http://blog.csdn.net/xuanyuansen/article/details/43152311,centos system.


Third, Caffe layer development in Google's PROTOBUF format, need to install the dependency, recommended installation 2.6.1 version (GCC version recommended 4.4.7), for the https://github.com/google/protobuf/ Releases/download/v2.6.1/protobuf-2.6.1.tar.gz, follow the steps in the Readme file to install.


Four, Python installation, Caffe provides Python interface, can be used in Python related development, but also in the Ipython-notebook to draw the network structure, very convenient. In order to use these features, Recommended on the target machine to compile the installation python2.7.10, the source see Python official website, for multi-user environment considerations, it is highly recommended to install the target user's own Python, you can set up a USR folder under their own user's home, unzip the source code, add the following configuration command:


./configure--enable-shared \

--prefix=${home}/usr/local \

Ldflags= "-wl,-rpath=${home}/usr/local/lib"

Make && make install


That is, a Lib file that requires Python can be shared by other programs, and Rpath is followed by its own path.


After installation, you need to configure the BASHRC file under the target user, add the following line:

Path=/home/lianhua/usr/local/bin: $PATH

The source BASHRC file is then installed successfully if the Python version is entered correctly, otherwise the check path is recompiled.


Python installs the pip after installation, download get-pip.py on the official website, then install the corresponding version of Protobuf, and install the Caffe official instructions to install other dependencies:

For req in $ (cat requirements.txt); do pip install $req; Done


V. Installation of Openblas

Download and install the installation package from Openblas official website, install the Readme file to install, Make&&make installs, may require sudo permission.


Six, Yum relies on installation

To participate in the official documentation http://caffe.berkeleyvision.org/install_yum.html, need to install all dependencies above, first need to install and system corresponding to the latest repository file, then execute sudo yum Install Epel-release, update the site so that the most up-to-date dependencies are installed.


Vii. installation of OpenCV

The predecessor needs to install the newer version of the CMake, go to the official website to download the installation.

There are two ways to install OpenCV:

1, download the source package installation, please refer to:

http://www.javieriparraguirre.net/installing-opencv-debian/(dependent installation, CentOS similar)

http://www.jianshu.com/p/a41da779f763 (OPENCV installation)

2, using automatic script installation:

Address: Https://github.com/jayrambhia/Install-OpenCV



Eight, Caffe installation configuration

Here we can finally get to the point, the installation of Caffe, if the above installation process is smooth, caffe installation will not be too big problem. The key is to properly configure the Makefile.config file, you need to modify the following configuration to the appropriate path (refer to the profile of the comments, confused place Google can):

1, Cuda_dir

2, BLAS: = open,blas_include: =,blas_lib:

3, Python_include: =

Note that you need to add the path to Python under NumPy

4, Python_lib: =

5, With_python_layer: = 1

Note that the PYTHON HDF5 installation path needs to be added to: include_dirs: = $ (Python_include) and Library_dirs: = $ (Python_lib)


After modifying the above configuration file, go back to the root directory of Caffe, execute make ALL-J4, note that the process is not too much, otherwise there will be strange errors;

Make Test-j4

Make Runtest-j4

At this point Caffe the main program is compiled.

The following compiles Pycaffe to execute

Make Pycaffe

Make Distribute

After execution, modify the BASHRC file to add

Pythonpath=${home}/caffe/distribute/python: $PYTHONPATH

Ld_library_path=${home}/caffe/build/lib: $LD _library_path

Allows Python to find Caffe dependencies.

Enter Python,import Caffe, if successful then all OK, otherwise check the path from the beginning, and even need to recompile python.


Ps:

Problems can always google,bless!!!

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Deep learning Tools Caffe Detailed Installation Guide

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.