"Caffe" Ubuntu16.04 Configuration Installation Caffe (only CPU)

Source: Internet
Author: User
Tags git clone

First, look at your own system, UBUNTU16.04,CPU, no nvidia, no OPENCV

Second, install the dependency package

    • Install PROTOBUF,LEVELDB,SNAPPY,OPENCV,HDF5, protobuf compiler andboost:
sudo apt-get install Libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf- Compilersudo apt-get install--no-install-recommends Libboost-all-dev
    • Install Gflags,glogs, Lmdb Andatlas.
sudo apt-get install Libgflags-dev libgoogle-glog-dev liblmdb-devsudo apt-get Install libatlas-Base-dev

Third, download Caffe

git clone git://github.com/bvlc/caffe.git

Iv. Compiling Caffe

    • Switch to the directory where Caffe is located
CP Makefile.config.example Makefile.config
    • Configure Makefile.config

1) Cpu_only: = 1 (just remove the front # on the line)

2) configuration of some reference files (added mainly to solve the new version, HDF5 path problem) (Modify the contents)

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
    • Make Caffe (8 represents 8 cores. J4 or not add to the line)
Make all---j8
    • The compilation succeeds, otherwise execute make clean multiple execution.

V. Compiling the Python interface

The Caffe has a Python\c++\shell interface, which is especially handy in Caffe Python, and has an interface in the instance.

    • Make sure PIP is installed
sudo apt-get Install Python-pip
    • Go to the Caffe folder, enter the Python folder inside, then enter
  for in do pip install $req;

If you're not prompted enough, that's right.

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

    • Compiling the Python interface
Make Pycaffe
    • Go to the Python folder inside the Caffe folder and record the current path (PWD). Finally open the ~/.BASHRC file and add it to the last line in the file (whatever your root directory is)
Export Pythonpath=/path/to/caffe/python: $PYTHONPATH

Vi.. Test

This time should be able to test: (in the Python directory, otherwise you will be prompted to find Caffe)
$ python2.7Python2.7. A(default, Jul1  ., the: A: -) [GCC5.4.0 20160609] on Linux2type" Help","Copyright","credits"Or"License"  forMore information.>>>Import Caffe>>>

Instructions to install all completed!

Seven, error

-import Caffe when the Scikit-image error is displayed, then install the scikit-image just fine. The lack of others on Baidu install other
Pip Install Scikit-image

-Make a clean and make after other errors

"Caffe" Ubuntu16.04 Configuration Installation Caffe (only CPU)

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.