zoukankan      html  css  js  c++  java
  • ubuntu配置caffe的python接口pycaffe

    参考网站:

    http://blog.csdn.net/sanmao5/article/details/51923982 (主要参考)

    https://github.com/BVLC/caffe/issues/782 (问题解决)

     

    ubuntu配置caffe的python接口pycaffe

    1. 依赖

    前提caffe已经正确编译。见Ubuntu配置caffe

    1. 库包
      1. sudo apt-get install python-pip
      2. sudo atp-get install python-dev python-numpy
      3. sudo apt-get install gfortran
      4.  
      5. sudo pip install –r python/requirements.txt
      6. sudo pip install pydot

        numpy scipy matplotlib sklearn skimage h5py protobuf leveldb networkx nose pandas gflags Cython ipython gfortran

    2. 路径
      1. vi ~/.bashrc

    export PYTHONPATH=/usr/caffe/python:$PYTHONPATH

    export PYTHONPATH=/usr/caffe/python/caffe:$PYTHONPATH//千万不要加这个

    1. source ~/.bashrc
    1. 编译
      1. cd caffe
      2. make pycaffe
    2. 问题与解决

    问题:

    Traceback (most recent call last):

    File "<stdin>", line 1, in <module>

    File "/Users//anaconda/lib/python2.7/site-packages/numpy/__init__.py", line 153, in <module>

    from . import add_newdocs

    File "/Users//anaconda/lib/python2.7/site-packages/numpy/add_newdocs.py", line 13, in <module>

    from numpy.lib import add_newdoc

    File "/Users//anaconda/lib/python2.7/site-packages/numpy/lib/__init__.py", line 22, in <module>

    from .npyio import *

    File "/Users//anaconda/lib/python2.7/site-packages/numpy/lib/npyio.py", line 4, in <module>

    from . import format

    File "/Users//anaconda/lib/python2.7/site-packages/numpy/lib/format.py", line 141, in <module>

    import io

    File "io.py", line 2, in <module>

    import skimage.io

    File "/Users//anaconda/lib/python2.7/site-packages/skimage/__init__.py", line 171, in <module>

    from .util.dtype import *

    File "/Users//anaconda/lib/python2.7/site-packages/skimage/util/__init__.py", line 1, in <module>

    from .dtype import (img_as_float, img_as_int, img_as_uint, img_as_ubyte,

    File "/Users//anaconda/lib/python2.7/site-packages/skimage/util/dtype.py", line 8, in <module>

    dtype_range = {np.bool_: (False, True),

    AttributeError: 'module' object has no attribute 'bool_

    解决:

    https://github.com/BVLC/caffe/issues/782 (问题解决)

    SnShine

    Firstly, you need to have _caffe.so in caffe/python/caffe. If not, run 'make pycaffe' in caffe source folder.

    Secondly, you need to add only caffe/python to $PYTHONPATH but not caffe/python/caffe as mentioned in documentation. I don't know why adding caffe/python/caffe causes the error, though.

    seanbell

    @deartonym you should add $CAFFE_ROOT/python to your $PYTHONPATH, not $CAFFE_ROOT/python/caffe.

    If you add "$CAFFE_ROOT/python/caffe", then you won't be able to do "import caffe".

    Yangqing has posted:

    under the folder of caffe-master/python/caffe, where _caffe.so lies, there is an io.py, which would be wrongly used by numpy.

    developfeng

    If you succeeded "make pycaffe" without error and cannot solve the " AttributeError: 'module' object has no attribute 'bool_' " problem after you set PYTHONPATH, you'd better check if you set too much different PATHONPATH via "echo $PYTHONPATH", if have more than one path, you can logout and log in, then add "expoet PYTHONPATH=$PYTHONPATH:/home/develop/caffe/python", then have a try!

  • 相关阅读:
    Nucleus 的网络部分
    VS2005中TextBox的ReadOnly属性(转贴)
    VS2005中TextBox的ReadOnly属性导致的问题
    外部中断
    Linux操作系统文件链接问题
    IIS 服务不能自动启动
    转贴:[C++]static用法
    串口测试的一些体会
    字符串的两种声明方式
    Tornado 2.2 中vxsim出问题的解决方法
  • 原文地址:https://www.cnblogs.com/yizhichun/p/6339789.html
Copyright © 2011-2022 走看看