上采样(Upsampling)与反卷积(Deconvolution)的区别

1.上采样和反卷积是不一样的,大家要注意这一点。可以参考这篇博客:https://blog.csdn.net/qq_27871973/article/details/82973048

2.对于pad默认为0,自己如果有需要得进行设置。group默认为1.

3.对于卷积和反卷积的维度计算公式:参考博客:https://blog.csdn.net/where_is_my_keyboard/article/details/80328093 

对于convolution:

output = (input + 2 * p - k) / s + 1;

对于deconvolution:

output = (input - 1) * s + k - 2 * p;

其中,input为输入维度,s为stride;k为kernel_size;p表示pad,默认为0.
 

4.在caffe里面若想使用上采样,那么可以利用反卷积的type,对参数进行一定的限制。参考链接:https://www.zhihu.com/question/63890195/answer/214223863

这是文档

A common use case is with the DeconvolutionLayer acting as upsampling. You can upsample a feature map with shape of (B, C, H, W) by any integer factor using the following proto.
layer {
  name: "upsample", type: "Deconvolution"
  bottom: "{{bottom_name}}" top: "{{top_name}}"
  convolution_param {
    kernel_size: {{2 * factor - factor % 2}} stride: {{factor}}
    num_output: {{C}} group: {{C}}
    pad: {{ceil((factor - 1) / 2.)}}
    weight_filler: { type: "bilinear" } bias_term: false
  }
  param { lr_mult: 0 decay_mult: 0 }
}

你可能感兴趣的:(caffe)