Chapter 7 Windows下pycaffe的使用之draw_net.py

Chapter 6 中完成了在Windows下,对pycaffe的编译,如果编译存在问题,请参考:http://www.cnblogs.com/xiaopanlyu/p/6158902.html

本文接下来的内容假设已经编译好了pycaffe,直接进行使用。

1. 环境配置

为了和chapter 6 中编译pycaffe时使用的Python版本保持一致,这里使用的Python版本是 Python2.7.12-64bit.下载地址:https://www.python.org/downloads/release/python-2712/

1) 安装pip

在Windows cmd命令行中输入以下命令,本文以下命令未特别说明,均在此命令行下执行

命令:python -m pip install -U pip

2) 安装protobuf

命令:pip install protobuf

如果 版本不够高的话,可能还是会出现importerror的错误,可以使用升级

命令:pip install protobuf --upgrade

3) 安装pydot

命令:pip install pydot

4) 安装GraphViz

命令:pip install GraphViz

5) 安装scikit_image

命令:pip install scikit-image

如果安装出错,可以下载后本地安装,下载地址:http://www.lfd.uci.edu/~gohlke/pythonlibs

从这个网站下载scikit_image-0.12.3-cp27-cp27m-win_amd64.whl(对应python x64),此处建议也直接把6) 、7) 、8) 中药安装的包下载下来,直接本地安装

下载之后进行本地安装,注意文件路径

命令:pip install D:\your path\scikit_image-0.12.3-cp27-cp27m-win_amd64.whl

6) 安装scipy

命令:pip install D:\your path\scipy-0.18.0-cp27-cp27m-win_amd64.whl

7) 安装numpy-1.11.1+mkl

命令:pip install D:\your path\numpy-1.11.1+mkl-cp27-cp27m-win_amd64.whl

8) 安装matplotlib

命令:pip install D:\your path\matplotlib-1.5.3‑cp27‑cp27m‑win_amd64.whl

2. Draw Net

将network.prototxt复制到Release文件夹下,cmd到该路径下,根据以下使用提示绘制网络结构。

usage: draw_net.py [-h] [--rankdir RANKDIR] [--phase PHASE]

                   input_net_proto_file output_image_file

1) draw LeNet-5

命令:python draw_net.py --rankdir=BT lenet_train_test.prototxt LeNet-5.bmp

LeNet-5

2) draw CIFAR10_full

命令:python draw_net.py --rankdir=BT cifar10_full_train_test.prototxt cifar10_full.bmp

cifar10_full

3) draw CaffeNetConv

命令:python draw_net.py --rankdir=BT bvlc_caffenet_full_conv.prototxt bvlc_caffenet.bmp

bvlc_caffenet

3. 他山之石

如果觉得使用draw_net.py比较麻烦,推荐一个在线可视化的网站:http://ethereon.github.io/netscope/quickstart.html

当然各有优缺点,自行选择。

Reference

1. http://blog.csdn.net/LG1259156776/article/details/52563889

2. http://www.lfd.uci.edu/~gohlke/pythonlibs/

3. https://www.python.org/downloads/release/python-2712/

4. http://www.cnblogs.com/xiaopanlyu/p/6158902.html

posted @ 2016-12-17 18:26  AllenLYU  阅读(1767)  评论(1编辑  收藏  举报
levels of contents