0
votes

I have a conv layer of dimension nXmx16x1 and I want to calculate mean or sum of the 16 filters, so the result is 1 filter of dim nxmx1x1.

something like mean(A,3) in matlab

1

1 Answers

1
votes

Use a constant 1x1 "Conv" filter:

layer {
  name: "avg"
  type: "Convolution"
  bottom: "input"
  top: "output"
  param { lr_mult: 0 decay_mult: 0 }  # fix this layer, do not train
  convolution_param {
    num_output: 1
    kernel_size: 1
    bias: false  # no bias
    weight_filler: { type: "constant" value: 0.0625 }  # 1/16.
  }
}