Caffe installing CentOS without GPU

Source: Internet
Author: User
Tags gtk

Pre-record

Because it is in a long-time machine installed Caffe, the process is more complex, on the web said that the clean machine is relatively simple. If you can have a clean machine, you do not have to go through so many pits, I hope everyone good luck! Introduction here will not say, directly into the topic:

Caffe Home http://caffe.berkeleyvision.org/

GitHub Home Https://github.com/BVLC/caffe

Machine configuration:

[Email protected] build]# lsb_release-alsb Version:    : Base-4.0-amd64:base-4.0-noarch:core-4.0-amd64: core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-NoarchDistributor ID :    redhatenterpriseserverdescription:    6.3 (Santiago) Release:    6.3

GCC version 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC)

Python 2.7.10

Python has NumPy installed, no GPU

Prerequisites
    • CUDA is required for GPU mode.
      • Library version 7.0 and the latest driver version was recommended, but 6.* was fine too
      • 5.5, and 5.0 is compatible but considered legacy
    • BLAS via ATLAS, MKL, or Openblas.
    • Boost >= 1.55
    • OpenCV >= 2.4 including 3.0
    • protobufglog,gflags
    • IO libraries,, hdf5 leveldb snappy ,lmdb

Pycaffe and Matcaffe interfaces have their own natural needs.

    • For Python Caffe: Python 2.7 or Python 3.3+ , numpy (>= 1.7) boost-providedboost.python
    • For MATLAB Caffe:matlab with the mex compiler.

1. Install various dependency packages

Yum install-y gcc gcc-c++ gtk+-devel libjpeg-devel libtiff-devel jasper-devel libpng-devel zlib-devel cmakeyum instal L git gtk2-devel pkgconfig numpy python python-pip python-devel gstreamer-plugins-base-devel libv4l ffmpeg- Devel mplayer mencoder flvtool2yum Install libdc1394 libdc1394-devel.x86_64yum install GTK*

2. Python Package Installation

Download Caffe source code, according to the./caffe/caffe-master/python/requirements.txt Install the required packages, with PIP installation is more convenient, do not download manual installation, no problem.

3. Installation protobuf , gloggflags

First, from the relatively simple:

4. Installing Cuda

Download the latest CUDA7.5 from the NVIDIA website and choose from your own operating system, where you select the Cuda_7.5.18_linux.run to run directly:

./cuda_6.5.14_linux_64.run

After running, you will be selected to install the project, choose not to install the driver, otherwise error (driver installation is unable to locate the kernel source), that is, the first option no

5. Installing Openblas

ATLAS, MKL, or Openblas can be installed, previously used Openblas, this time it will be equipped with him

Download Openblas source code, installation is also very simple, make && do install, more please refer to Openblas compilation and installation introduction

6. Installing OPENCV

OpenCV installed more trouble, in the middle encountered a lot of problems, refer to the installation documentation, can also refer to the online many people to the automatic installation configuration script, because I installed a lot of problems, so the basic is their own manual installed.

First upgrade your own CMake to the latest version, yum default installed default, can only be manually upgraded, otherwise there will be a variety of warnings in the cmake stage.

Download OpenCV-3.0.0

Unzip opencv-3.0.0. ZIPCD opencv-3.0.0mkdir BUILDCD Build
Cmake-d cmake_build_type=release-d cmake_install_prefix=/usr/local.

# #如果不出问题
Make-j 32
sudo make install
sudo sh-c ' echo '/usr/local/lib ' >/etc/ld.so.conf.d/opencv.conf '
sudo ldconfig

Let's talk about the problems I encountered when I was make:

Q1: FFmpeg has been installed, error Avcodecid not declared

CAP_FFMPEG_IMPL.HPP:1556:83: Error: No declaration was given before using enum ' Avcodecid '

A1: The workaround is to add the make parameter-D With_ffmpeg=off, reference

Q2: parallel_for_pthreads undefined reference error appears only in CentOS

A2: Need to change the modules/core/src/parallel.cpp file, reference 1, reference 2, I only follow the reference 2 to the Parallel.cpp file

Q3: Appears undefined reference to ' jpeg_default_qtables '

.. /.. /.. /lib/libopencv_imgcodecs.so.3.0.0:undefined reference to ' Jpeg_default_qtables '

A3: Installation, jpegsrc.v9a.tar.gz, reference 1, reference 2, reference 3

Tar-XZVF jpegsrc.v9.tar.gzcd jpeg-9. /configuremake libdir=/usr/lib64make libdir=/usr/lib64 Install

Q4: The compilation is complete, but there is still a problem:

[100%] Linking CXX shared library. /.. /lib/cv2.so/usr/bin/ld:/usr/local/lib/libpython2.7.a (ABSTRACT.O): Relocation r_x86_64_32 against '. rodata.str1.8 ' can not is used when making a shared object; Recompile with-FPIC/usr/local/lib/libpython2.71make[2]: * * [lib/cv2.so] Error 1make[ 1]: * * [Modules/python2/cmakefiles/opencv_python2.dir/all] Error2 * * * [ALL] Error 2

A4: Adding when recompiling installation python,configure--enable-shared,参考

./configure--enable-sharedmakemake Install

May appear after reinstallation, error while executing python while loading shared libraries:libpython2.7.so.1.0:cannot open shared object file:no such F Ile or directory, the workaround is:

vi/etc/ld.so.conf  ## Add the Lib library address on python2.7, like my/usr/local/python2.7/ LIB, save file /sbin/ldconfig

7. Installing Caffe

If the above installation is not a problem, this should not be error-free

Unzip caffe-MASTER.ZIPCD Caffe-
# Modify the configuration according to the actual situation Cpu_only:= 1 BLAS:= Open

Make all

8. Running the minist example

Reference

$CAFFE _root . /data/mnist/get_mnist.sh. /examples/mnist/create_mnist.sh

Caffe installing CentOS without GPU

Related Article

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.