IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    How to install caffe 1.0 with Anaconda python3 on centos7

    五四陈科学院发表于 2017-07-04 15:45:49
    love 0

    以下内容由[五四陈科学院]提供

    Caffe is a deep learning framework made with expression, speed, and modularity in mind. It is developed by Berkeley AI Research (BAIR) and by community contributors.

    The official website is http://caffe.berkeleyvision.org/ .

    It is easy to install it with python 2 and Ubuntu.But it is hard to install it with python 3 and centOs.

    Here are some records when I install it with Anaconda python3 on centos7.

    Platform

    Prior to installing, have a glance through this blog and take note of the details for your platform.

    $cat /etc/redhat-release
      
      CentOS Linux release 7.*.* (Core)
      
      $python --version
      
      Python 3.4.3 :: Anaconda 2.3.0 (64-bit)
      
      $pip --version
      
      pip 7.0.3 from /home/work/anaconda3/lib/python3.4/site-packages (python 3.4)

    Dependencies

    $sudo yum install gflags-devel glog-devel lmdb-devel openblas-devel leveldb-devel snappy-devel opencv-devel hdf5-devel

    Python and boost Dependencies

    Fist of all,download the dependencies.

    $git clone --depth 1 https://github.com/BVLC/caffe.git
      
      $wget http://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz/download
      
      $wget 'https://github.com//protobuf/releases/download/v3.3.0/protobuf-cpp-3.3.0.tar.gz'
      
      $wget 'https://github.com//protobuf/releases/download/v3.3.0/protobuf-python-3.3.0.tar.gz'

    Install the dependencies:

    1.python libs:

    $cd caffe/python
      
      $for req in $(cat requirements.txt) pydot; do /usr/bin/pip install $req -i https://pypi.mirrors.ustc.edu.cn/simple; done

    If you are not in China,remove the -i url parameter.

    2.pb libs:

    $cd ../..;tar zxvf boost_1_59_0.tar.gz;tar zxvf protobuf-cpp-3.3.0.tar.gz;tar zxvf protobuf-python-3.3.0.tar.gz
      
      $cd protobuf-3.3.0/
      
      $./configure
      
      $make && make install
      
      $cd python/
      
      $python setup.py build
      
      $python setup.py install
      
      $sudo ln -s /usr/local/lib/libprotobuf.so.13.0.0 /usr/lib64/libprotobuf.so.13

    3.boost libs:

    $cd boost_1_59_0/
      
      $./bootstrap.sh 
      
      $./b2 cxxflags="-I /home/work/anaconda3/include/python3.4m/"
      
      $sudo ./b2 install --prefix=/usr cxxflags="-I /home/work/anaconda3/include/python3.4m/"

    Install Caffe

    The last step:

    $cd caffe
      
      $git checkout -b 1.0
      
      $vim Makefile.config
      
      change the config like this:
      
      BLAS := open
      
      BLAS_INCLUDE := /usr/include/openblas
      
      PYTHON_INCLUDE := /home/work/anaconda3/include \
                             /home/work/anaconda3/include/python3.4m \
                             /home/work/anaconda3/lib/python3.4/site-packages/numpy/core/include
      
      PYTHON_LIBRARIES := boost_python3 python3.4m
      
      $make
      
      $make pycaffe
      
      $export PYTHONPATH=$PYTHONPATH:/home/work/soft/src/caffe/python

    TEST

    $cd caffe
      $make test && make runtest

    Good luck!


    想快点找到作者也可以到weibo上留言: @54chen
    或者你懒得带上,请到新浪微博:@54chen


沪ICP备19023445号-2号
友情链接