|
运行caffe的python/draw_net.py报错:AttributeError: 'google.protobuf.pyext._message.RepeatedScalarConta' object has no attribute '_values'
使用caffe的可视化工具 生成模型结构图
AttributeError: ‘google.protobuf.pyext._message.RepeatedScalarConta’ object has no attribute ‘_values’
This requires pydot>=1.0.2, which is not included in requirements.txt since
it requires graphviz and other prerequisites outside the scope of the
Caffe.
sudo apt-get install graphviz
pydot is not supported under python 3 and pydot2 doesn't work properly.
pydotplus works nicely (pip install pydotplus)
遇到这个问题看到网上很多人说是protobuf的版本太高的缘故,但是东方耀亲自试了一下,将现有的protobuf3.9.1卸载,重新安装protobuf2.6.1 和 2.5.0
但是这个操作没有解决问题,反而出现了一些由于版本过低导致的报错,在此就不列举了。
因此在这里介绍另一种解决方案:
找到文件python/caffe/draw.py,将其94、96、98行变量后面的if ... else ...语句删除,变成(89-98行):
node_label = '"%s%s(%s)%skernel size: %d%sstride: %d%spad: %d"' %\
(layer.name,
separator,
layer.type,
separator,
layer.convolution_param.kernel_size[0], #这里被修改了
separator,
layer.convolution_param.stride[0], #这里被修改了
separator,
layer.convolution_param.pad[0] #这里被修改了)
重新编译:
再运行应该就可以了。
另外Caffe的网页版可视化工具(需要翻墙):https://ethereon.github.io/netscope/#/editor
将*.prototxt中的内容复制到左边黑色文本框中,然后shift+enter即可在右边显示网络结构
|
|