【问题标题】:caffe: sum of conv layer with a single filtercaffe:带有单个过滤器的卷积层的总和
【发布时间】:2018-11-26 15:42:27
【问题描述】:

我有一个尺寸为 nXmx16x1 的卷积层和另一个尺寸为 nxmx1x1 的过滤器“F”。如何将 F 与 conv 层的每个过滤器相加(结果维度:nxmx16x1)。

据我所知,eltwise 需要两个底部的尺寸完全相同(包括通道数)

【问题讨论】:

  • 您要求和还是乘法?你能写出你想要做什么的方程式吗?
  • 我需要总和或平均值。我还更新了结果的暗淡。我需要类似 eltwise 的东西,但它需要 2 个底部完全相同的暗淡(这里不是这种情况 - 通道尺寸不同)
  • 所以你想要out_m,n,i,0 <- in_m,n,i,0 + F_m,n,0,0i=0..15

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


【解决方案1】:

您似乎正在寻找"Tile" 层(类似于repmat)。将"F" 沿axis: 2 平铺16 次将使"F" 与输入的形状相同,然后您可以使用"Eltwise" 层:

layer {
  name: "tile_f"  
  type: "Tile"
  bottom: "F"    # input shape  n-c-h-w
  top: "tile_f"  # output shape n-c-16*h-w
  tile_param { axis: 2 tiles: 16 }  # tile along h-axis 16 times
}
# now you can eltwise!
layer {
  name: "sum_f"
  type: "Eltwise"
  bottom: "x"
  bottom: "tile_f"  # same shape as x!!
  top: "sum_f"
  eltwise_param { operation: SUM }
}

【讨论】:

    猜你喜欢
    • 2018-11-27
    • 2018-11-24
    • 2018-09-30
    • 1970-01-01
    • 2018-02-10
    • 2017-11-28
    • 1970-01-01
    • 2021-09-11
    • 2019-11-28
    相关资源
    最近更新 更多