caffe---之deconv

本文详细介绍了Caffe框架中BilinearFiller类的使用方法及其在Deconvolution层中实现特征图上采样的应用。通过具体配置示例,阐述了如何设置参数以实现整数倍上采样,保持双线性插值系数不变,并提供了与Python Scikit.Image库等效操作的对比。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

template<typename Dtype>
class caffe::BilinearFiller< Dtype >

Fills a Blob with coefficients for bilinear interpolation.

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 }

}

Please use this by replacing {{}} with your values. By specifying num_output: {{C}} group: {{C}}, it behaves as channel-wise convolution. The filter shape of this deconvolution layer will be (C, 1, K, K) where K is kernel_size, and this filler will set a (K, K) interpolation kernel for every channel of the filter identically. The resulting shape of the top feature map will be (B, C, factor * H, factor * W). Note that the learning rate and the weight decay are set to 0 in order to keep coefficient values of bilinear interpolation unchanged during training. If you apply this to an image, this operation is equivalent to the following call in Python with Scikit.Image.

out = skimage.transform.rescale(img, factor, mode='constant', cval=0)

总结:上面的计算公式是反卷积大小的计算公式

链接:http://caffe.berkeleyvision.org/doxygen/classcaffe_1_1BilinearFiller.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值