Caffe下利用drawnet画网络图攻略

1.下载Windows版Caffe
解压后,在windows目录下发现Caffe 2013工程

工程为64位
2.编译通过后,将D:\caffe-windows\python下的draw_net和D:\caffe-windows\examples\mnist\lenet_train_test.prototxt复制到d:\test下



3. cmd下输入Python draw_net.py lenet_train_test.prototxt lenet.png


-----------------------------------------------------------------------------
D:\test>Python draw_net.py lenet_train_test.prototxt lenet.png
Traceback (most recent call last):
File "draw_net.py", line 9, in <module>
import caffe.draw
File "D:\caffe\pycaffe\caffe\draw.py", line 22, in <module>
import pydot
ImportError: No module named pydot

解决办法:
必须先安装 graphviz,再安装pydot
D:\test>pip install graphviz
Collecting graphviz
Downloading graphviz-0.4.10-py2.py3-none-any.whl
Installing collected packages: graphviz
Successfully installed graphviz-0.4.10

D:\test>pip install pydot
Collecting pydot
Downloading pydot-1.2.2.tar.gz
Requirement already satisfied (use --upgrade to upgrade): pyparsing>=2.1.4 in c:\python27\lib\site-packages (from pydot)
Installing collected packages: pydot
Running setup.py install for pydot ... done
Successfully installed pydot-1.2.2
------------------------------------------------------------------------
D:\test>Python draw_net.py lenet_train_test.prototxt lenet.png
Drawing net to lenet.png
Traceback (most recent call last):
File "draw_net.py", line 45, in <module>
main()
File "draw_net.py", line 41, in main
caffe.draw.draw_net_to_file(net, args.output_image_file, args.rankdir)
File "D:\caffe\pycaffe\caffe\draw.py", line 222, in draw_net_to_file
fid.write(draw_net(caffe_net, rankdir, ext))
File "D:\caffe\pycaffe\caffe\draw.py", line 204, in draw_net
return get_pydot_graph(caffe_net, rankdir).create(format=ext)
File "C:\Python27\lib\site-packages\pydot.py", line 1876, in create
prog=prog))
Exception: "dot.exe" not found in path.
解决办法:
下载 http://www.graphviz.org/Download_windows.php windows下的 graphviz安装
Graphviz 2.30: The msi installer is again causing problems with the PATH variable. We hope to have this fixed shortly.

graphviz current stable release development snapshot
Windows graphviz-2.38.msi
graphviz-2.38.zip
 
安装graphviz-2.38.msi, 选择for everyone 否则会出错;
在path中设置graphviz路径,否则pydot解析不出来, 如C:\Program Files (x86)\Graphviz2.38\bin


成功


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值