【问题标题】:How to reshape layer in caffe with python?如何用python重塑caffe中的图层?
【发布时间】:2016-07-20 20:58:23
【问题描述】:

可以在 prototxt 文件中使用"Reshape" 层。
但是,尝试在 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'

【问题讨论】:

    标签: python neural-network deep-learning caffe pycaffe


    【解决方案1】:

    试试:

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

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

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

    【讨论】:

      猜你喜欢
      • 2015-03-21
      • 2017-07-26
      • 1970-01-01
      • 1970-01-01
      • 2019-12-28
      • 2016-07-15
      • 2015-08-21
      • 1970-01-01
      • 2016-04-05
      相关资源
      最近更新 更多