Wednesday, June 22, 2016

Installing Cafee for Deep Learning

General dependencies

sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler
sudo apt-get install --no-install-recommends libboost-all-dev 
 
before Installing the dependencies, check whether they are already installed:
 
sudo dpkg-query -l libopencv*
 
||/ Name                           Version              Architecture         Description
+++-==============================-====================-====================-=================================================================
rc  libopencv-calib3d2.4:i386      2.4.8+dfsg1-2ubuntu1 i386                 computer vision Camera Calibration library
rc  libopencv-contrib2.4:i386      2.4.8+dfsg1-2ubuntu1 i386                 computer vision contrib library
rc  libopencv-core2.4:i386         2.4.8+dfsg1-2ubuntu1 i386                 computer vision core library
rc  libopencv-features2d2.4:i386   2.4.8+dfsg1-2ubuntu1 i386                 computer vision Feature Detection and Descriptor Extraction libra
rc  libopencv-flann2.4:i386        2.4.8+dfsg1-2ubuntu1 i386                 computer vision Clustering and Search in Multi-Dimensional spaces
rc  libopencv-gpu2.4:i386          2.4.8+dfsg1-2ubuntu1 i386                 computer vision GPU library
....


so none of the are installed. You can use the following command too: 
 
sudo  dpkg -s libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev 
 
libhdf5-serial-dev protobuf-compiler

Prints:

dpkg-query: package 'libprotobuf-dev' is not installed and no information is available

dpkg-query: package 'libleveldb-dev' is not installed and no information is available

dpkg-query: package 'libsnappy-dev' is not installed and no information is available

dpkg-query: package 'libopencv-dev' is not installed and no information is available

dpkg-query: package 'libhdf5-serial-dev' is not installed and no information is available

dpkg-query: package 'protobuf-compiler' is not installed and no information is available

BLAS: install ATLAS by sudo apt-get install libatlas-base-dev 
or install OpenBLAS or MKL for better CPU performance. 
 
(Note: it was already installed in my system and up to date) 

Install Following Package: (for ubuntu 14.04)

sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev
 

Make File Configuration: (From Cafee Documentation)

Caffe has several dependencies:

  • CUDA is required for GPU mode.
    • library version 7+ and the latest driver version are recommended, but 6.* is fine too
    • 5.5, and 5.0 are compatible but considered legacy
  • BLAS via ATLAS, MKL, or OpenBLAS.
  • Boost >= 1.55
  • protobuf, glog, gflags, hdf5
Optional dependencies:

  • OpenCV >= 2.4 including 3.0
  • IO libraries: lmdb, leveldb (note: leveldb requires snappy)
  • cuDNN for GPU acceleration (v5)
Pycaffe and Matcaffe interfaces have their own natural needs.

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

 

cuDNN Caffe: for fastest operation Caffe is accelerated by drop-in integration of NVIDIA cuDNN. To speed up your Caffe models, install cuDNN then uncomment the USE_CUDNN := 1 flag in Makefile.config when installing Caffe. Acceleration is automatic. The current version is cuDNN v5; older versions are supported in older Caffe.

CPU-only Caffe: for cold-brewed CPU-only Caffe uncomment the CPU_ONLY := 1 flag in Makefile.config to configure and build Caffe without CUDA. This is helpful for cloud or cluster deployment.


Edit Makfile.config.example for your need:

cp Makefile.config.example Makefile.config
# Adjust Makefile.config (for example, if using Anaconda Python, or if cuDNN is desired)
make all
make test
make runtest
 
after make runtest: (which nearly takes 6 minutes) 
 
[----------] 2 tests from SigmoidCrossEntropyLossLayerTest/1, where TypeParam = caffe::CPUDevice<double>
[ RUN      ] SigmoidCrossEntropyLossLayerTest/1.TestGradient
[       OK ] SigmoidCrossEntropyLossLayerTest/1.TestGradient (4 ms)
[ RUN      ] SigmoidCrossEntropyLossLayerTest/1.TestSigmoidCrossEntropyLoss
[       OK ] SigmoidCrossEntropyLossLayerTest/1.TestSigmoidCrossEntropyLoss (7 ms)
[----------] 2 tests from SigmoidCrossEntropyLossLayerTest/1 (11 ms total)

[----------] Global test environment tear-down
[==========] 1090 tests from 150 test cases ran. (358598 ms total)
[  PASSED  ] 1090 tests.
 


 Means that you have sucessfully installed cafe on your machine! Hurrah!!!!!!

No comments:

Post a Comment