Ubuntu Configuration Caffe Python interface Pycaffe

Source: Internet
Author: User

Reference website:

http://blog.csdn.net/sanmao5/article/details/51923982 ( main reference )

https://github.com/BVLC/caffe/issues/782 ( problem solving )

Ubuntu Configuration Caffe Python interface Pycaffe

    1. Depend on

caffe has been compiled correctly. See ubuntu configure caffe

  1. library package
    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 GF Ortran

  2. Path
    1. VI ~/.BASHRC

Export Pythonpath=/usr/caffe/python: $PYTHONPATH

export Pythonpath=/usr/caffe/python/caffe: $PYTHONPATH// Please don't add this .

    1. SOURCE ~/.BASHRC
    1. Compile
      1. CD Caffe
      2. Make Pycaffe
    2. Problems and Solutions

Problem:

Traceback (most recent):

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 A, in <module>

From Numpy.lib import Add_newdoc

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

From. Npyio Import *

File "/users//anaconda/lib/python2.7/site-packages/numpy/lib/npyio.py", line 4, <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, <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, <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, <module>

Dtype_range = {Np.bool_: (False, True),

Attributeerror: ' Module ' object has no attribute ' Bool_

Solve:

https://github.com/BVLC/caffe/issues/782 ( problem solving )

Snshine

Firstly, you need _caffe.so In Caffe/python/caffe. If not, the run ' make Pycaffe ' in Caffe source folder.

Secondly, you need to add is Caffe/python to $PYTHONPATH and 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" and then you won ' t is 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 being wrongly used by num Py.

Developfeng

If you succeeded "make Pycaffe" without error and cannot solve the "Attributeerror: ' Module ' object have no attribute ' Bool_ ' "problem after your set PYTHONPATH, you ' d better check if you set too much different Pathonpath via"Echo $PYTHONPATH", if has more than than one path, you can logout and login, thenadd" Expoet Pythonpa Th= $PYTHONPATH:/home/develop/caffe/python ", then has a try!

Ubuntu Configuration Caffe Python interface Pycaffe

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.