如何用python重塑caffe层?

2024-10-03 23:20:36 发布

您现在位置:Python中文网/ 问答频道 /正文

可以在prototxt文件中使用^{}层。
但是,尝试在python中使用它(使用NetSpec()):

n.resh = L.Reshape(n.fc3, reshape_param={'shape':'{dim:1 dim:1 dim:64 dim:64}'})

我只有错误:

AttributeError: 'BlobShape' object has no attribute 'append'

Tags: 文件objectparam错误attributeerrorhasshapedim
1条回答
网友
1楼 · 发布于 2024-10-03 23:20:36

尝试:

n.resh = L.Reshape(n.fc3, reshape_param={'shape':{'dim': [1, 1, 64, 64]}})

请注意,形状向量[1, 1, 64, 64]是作为列表传递的,而不是像prototxt语法中那样作为字符串传递的。在

事实上,在使用NetSpec接口时,caffe.proto中定义为repeated的任何条目都应被视为列表/向量。在

相关问题 更多 >