[caffe笔记001]:caffe依赖库安装(非root)

来源:互联网 发布:92game 极客网源码 编辑:程序博客网 时间:2024/05/22 09:42

[========]

1. caffe介绍

caffe是一个训练卷积神经网络的工具,其能够非常好的支持CNN,最新版本整合了RNN。caffe提供python和matlab的借口,能够简单有效地进行编程和使用。

2. caffe安装

2.1 caffe版本选择

  • 官网版本
    版本随时更新
    https://github.com/BVLC/caffe
  • R-CNN
    caffe v0.999版
    https://github.com/BVLC/caffe/archive/v0.999.tar.gz
  • FCN
    caffe-future
    https://github.com/longjon/caffe/tree/future
  • DSN
    不清楚其版本号
    https://github.com/s9xie/DSN

2.2 依赖库安装

2.2.1 有root权限

网上教程很多。

2.2.2 非root权限

在已经安装好cuda和python以及各种常用的python依赖包之后,caffe在编译之前只需要安装以下依赖库:
- protobuf
- snappy
- leveldb
- openCV
- boost
- lbdb
- gflags
- glog
- hdf5
- openblas, atlas, mkl三选一

Install protobuf:
版本:2.5.0
安装python版
下载完成之后

    $ cd protobuf/    $ cd python    $ python setup.py build    $ python setup.py install --user
    $ cd ~/temp/    $ git clone https://github.com/google/protobuf.git    $ cd protobuf/    $ ./autogen.sh    $ ./configure --prefix=$HOME/local    $ make    $ make install

Install snappy:

    $ cd ~/temp/    $ git clone https://github.com/google/snappy.git    $ cd snappy    $ ./autogen.sh    $ ./configure --prefix=$HOME/local    $ make    $ make install

Install leveldb:

    $ cd ~/temp/    $ git clone https://github.com/google/leveldb.git    $ cd leveldb    $ make    $ cp -av libleveldb.* $HOME/local/lib/    $ cp -av include/leveldb $HOME/local/include/

最后两步可以直接手动拷贝

Install OpenCV:
版本:2.4.8

http://stackoverflow.com/questions/28010399/build-opencv-with-cuda-support

    $ cd ~/temp/    $ wget 'https://github.com/Itseez/opencv/archive/2.4.8.tar.gz'    $ tar xzf 2.4.8.tar.gz    $ cd opencv-2.4.8/    $ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=$HOME/local -D BUILD_opencv_gpu=OFF -D CUDA_GENETATION=AUTO ..    $ make    $ make install

Install Boost:

版本:1.55.0

    $ cd ~/temp/    $ wget “http://sourceforge.net/projects/boost/files/boost/1.55.0/boost_1_55_0.tar.gz”    $ tar xzf boost_1_55_0.tar.gz    $ cd boost_1_55_0    ($ ./bootstrap.sh --prefix=$HOME/local)    $ ./bootstrap.sh --prefix=$HOME/local --with-python=python2.7    $ ./b2 -j 32    $ ./b2 install    ...failed updating 2 targets...    ...skipped 6 targets...    ...updated 62 targets...

Install lmdb:

    $ cd ~/temp    $ git clone https://github.com/LMDB/lmdb    $ cd mdb/libraries/liblmdb    $ make    $ mkdir $HOME/local/man/man1    $ make prefix=$HOME/local install

Install gflags:
版本:1.7,需要先安装gflags,再安装glog,其它依赖库可以并行安装

    $ cd ~/temp/    $ git clone https://github.com/gflags/gflags/release/    $ mkdir build && cd build    $ bash    $ export CXXFLAGS="-fPIC"     $ ./configure --prefix=$HOME/local ..    $ make -j    $ make install

版本:2.1.1

    $ cd ~/temp/    $ git clone https://github.com/gflags/gflags/release/    $ mkdir build && cd build    $ bash    $ CXXFLAGS="-fPIC" cmake -D CMAKE_INSTALL_PREFIX=$HOME/local ..    $ make -j    $ make install

版本2.1.2后需要较高版本的CMake。

Install glog:
版本:0.3.3

    $ cd ~/temp/    $ wget https://google-glog.googlecode.com/files/glog-0.3.3.tar.gz    $ tar zxvf glog-0.3.3.tar.gz    $ cd glog-0.3.3    $ ./configure --prefix=$HOME/local    $ make && make install

Install hdf5:
matlab会自带hdf5,最好和matlab的版本号一致)。如果不一致,可以在linux设置环境变量

export HDF5_DISABLE_VERSION_CHECK=1

最新版版本号需要https://www.hdfgroup.org/ftp/HDF5/current/src/ 确认

    $ cd ~/temp    $ wget "https://www.hdfgroup.org/ftp/HDF5/current/src/hdf5-1.8.14.tar"     $ tar -xf hdf5-1.8.14.tar    $ cd hdf5-1.8.14    $ ./configure --prefix=$HOME/local    $ make    $ make check                # run test suite.    $ make install    $ make check-install        # verify installation.</pre>

OpenBlas:

$ cd ~/temp/$ git clone git://github.com/xianyi/OpenBLAS$ cd OpenBlas$ make FC=gfortran$ make PREFIX=$HOME/local install
1 0
原创粉丝点击