caffe执行draw.py的错误汇总

caffe执行draw.py的错误汇总

安装完caffe后,使用caffe时,有时候需要调用draw.py来画整个神经网络拓扑图,不过github上最新版本运行draw.py会报错,具体如下


错误1

执行命令

$cd caffe/python/

$python draw_net.py--rankdirTB ../examples/mnist/lenet.prototxt../examples/mnist/lenet_structure.jpg

会报如下错误:

Traceback(most recent call last):

File"draw_net.py", line 9, in <module>

importcaffe.draw

File"/root/caffe/python/caffe/draw.py", line 22, in <module>

import pydot

ImportError:No module named pydot


解决方法,安装pydot

sudo apt-get install python-pydot

或者pipinstall pydot



错误2

修复好错误1的情况下,执行

$python draw_net.py--rankdirTB ../examples/mnist/lenet.prototxt../examples/mnist/lenet_structure.jpg

会报如下错误:

Traceback(most recent call last):

File"draw_net.py", line 58, in <module>

main()

File"draw_net.py", line 54, in main

phase)

File"/root/caffe/python/caffe/draw.py", line 244, indraw_net_to_file

fid.write(draw_net(caffe_net,rankdir, ext, phase))

File"/root/caffe/python/caffe/draw.py", line 223, in draw_net

returnget_pydot_graph(caffe_net, rankdir, phase=phase).create(format=ext)

File"/root/caffe/python/caffe/draw.py", line 167, inget_pydot_graph

node_label= get_layer_label(layer, rankdir)

File"/root/caffe/python/caffe/draw.py", line 107, inget_layer_label

layer.pooling_param.kernel_size[0]if len(layer.pooling_param.kernel_size._values) else 1,

AttributeError:'int' object has no attribute '_values'


解决方案

github上查找解决方案

https://github.com/BVLC/caffe/issues/5324

文章链接上说是由于caffedraw.py本身错误引起,用老版本的caffedraw.py代替如果从直接github上下载的代码的话,最好用gitpull直接更新代码,git上最新的代码没有问题。

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值