Using Pycaffe to draw Caffe network diagrams

Source: Internet
Author: User
Tags microsoft website in python

Test Caffe can be used in Python, we can try to import caffe in Python.

Import Caffe

If the success of the words can jump directly to the end of the text to see the picture, the failure of the words will often show:

Importerror:no module named _caffe

The Caffe path is not set correctly, then just come up and configure it. We need to first set the system environment variable Pythonpath, which is your Caffe directory under the Python folder $ (Caffe) \python. All files generated by the $ (Caffe) \build\x64\release\pycaffe\caffe directory are then copied to the $ (Caffe) \python\caffe directory.

We need to download and install GOOGLE.PROTOBUF, address at Google Protobuf releases. Download the Protobuf-python-3.1.0.zip and protoc-3.1.0-win32.zip, unzip them, and place the Protoc.exe in the Win32 package in the setup.py same directory of the Python package, and then execute the build command.

Python setup.py Build

Execute test to confirm that the compilation is correct

Python setup.py test

Output:

----------------------------------------------------------------------
Ran 590 tests in 1.079s

OK (skipped= 7)

Continue execution of install (this step cannot be omitted)

Python setup.py Install

Output:

Finished processing dependenceies for protobuf==3.0.0

After the setup was successful, we tried to import Caffe in Python,

The Skimage.io module is missing, indicating that additional scikit-image is required.

Pip Install Scikit-image

The result was wrong again,

What the hell is this? Visual C + + 9.0 is required. How to still need VS2008. None of the VS2013 on the machine. OK, also need to install a micorsoft Visual C + + Compiler for Python 2.7 package, go to Microsoft website to download a bar
Microsoft Visual C + + Compiler for Python 2.7

As a result, you will find that you also need to install Lapack/blas and so on all kinds of bags, it is crazy. Here we recommend a Python extension site,
Unofficial Windows Binaries for Python Extension Packages
It is recommended to download the corresponding WHL, first install NumPy + MKL, and then install SciPy, Scikit-image, Pydot, Graphviz respectively. Graphviz need to install an MSI package, download the address for Graph visualization Software. If the hint does not find Dot.exe, you will also need to add graphviz2.38\bin to the system environment variable path. All of this is done after installation.

Import Caffe

It finally worked. Have you forgotten what we are going to do today, for the most of your busy days ...

It's not a good thing to paint.
To execute the Draw Network Diagram command:

draw_net.py.. \examples\mnist\lenet_train_test.prototxt Lenet.png

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.