绘制网络模型,总显示这样的错误:
AttributeError: 'google.protobuf.pyext._message.RepeatedScalarConta' object has no attribute '_values'
具体内容见下:
caffe:>> ./python/draw_net.py ./examples/cifar10/cifar10_quick_train_test.prototxt ./visualization.png
Drawing net to ./visualization.png
Traceback (most recent call last):
File "./python/draw_net.py", line 45, in <module>
main()
File "./python/draw_net.py", line 41, in main
caffe.draw.draw_net_to_file(net, args.output_image_file, args.rankdir)
File "/home/andre/caffe/python/caffe/draw.py", line 222, in draw_net_to_file
fid.write(draw_net(caffe_net, rankdir, ext))
File "/home/andre/caffe/python/caffe/draw.py", line 204, in draw_net
return get_pydot_graph(caffe_net, rankdir).create(format=ext)
File "/home/andre/caffe/python/caffe/draw.py", line 151, in get_pydot_graph
node_label = get_layer_label(layer, rankdir)
File "/home/andre/caffe/python/caffe/draw.py", line 94, in get_layer_label
layer.convolution_param.kernel_size[0] if len(layer.convolution_param.kernel_size._values) else 1,
AttributeError: 'google.protobuf.pyext._message.RepeatedScalarConta' object has no attribute '_values'
这是由于你的protobuf的版本不对造成的,用pip install protobuf安装的版本号默认是最新的3.2.0。但是caffe不支持高于3.0.0版本的protobuf.
解决方法:卸载当前protobuf。(pip uninstall protobuf)
再指定安装低版本的,版主这里用的是2.5.0(pip install protobuf==2.5.0)
结束后再编译一遍pycaffe,就可以成功画出网络结构图了。
如果实在不能成功,也不要灰心,版主还提供在线网页绘制caffe网络结构图的方法,其实更简洁方便:

在尝试绘制网络模型时遇到AttributeError,提示protobuf对象无属性 '_values'。通过卸载现有protobuf并安装版本2.5.0,然后重新编译pycaffe,可以解决问题。若仍不成功,推荐使用在线工具如Netscope进行网络结构图的简洁绘制。
4111

被折叠的 条评论
为什么被折叠?



