How to set the params of Deconvolution in Caffe prototxt?

810 views
Skip to first unread message

csyking

unread,
Sep 22, 2016, 1:57:41 AM9/22/16
to Caffe Users
Hi All,

If the size of feature map is 4*4, how to set the params of Deconvolution to make the feature map to 7*7?

The Deconvolution layer is as follows:

layer {
  name: "deconv5_2"
  type: "Deconvolution"
  bottom: "conv5_2"
  top: "deconv5_2"
  param {
    lr_mult: 1
    decay_mult: 0
  }
  param {
    lr_mult: 2
    decay_mult: 0
  }
  convolution_param {
    num_output: 512
    pad: 1 # is right?
    stride: 1 # is right?
    kernel_size: 6 # is right?
    weight_filler {
      type: "xavier"
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}

What is the mathematical formula of deconvolution?

Any help I will be grateful!

Przemek D

unread,
Oct 28, 2016, 2:57:32 AM10/28/16
to Caffe Users
For convolution we have:
Y = (X + 2*p - k) / s + 1
Where s stands for stride, k for kernel size and p for padding, X is input size and Y for output. Deconvolution works exactly backwards, so all you want to do is reorganize the equation to free X:
X = s*(Y-1) - 2*p + k

Ali

unread,
Oct 28, 2016, 9:39:59 AM10/28/16
to Caffe Users
Reply all
Reply to author
Forward
0 new messages