HarmonyHu 多思不如养志,多言不如守静,多才不如蓄德

反卷积(DeConv)

2020-06-10
AI

概念

Deconvolution是Convolution的逆操作。Convolution是将大尺寸feature map转换成小尺寸feature map,而Deconvolution是将小feature map转换成大feature map。两者shape计算过程对比:

# Convolution:
kernel = ic * oc * kh * kw
on = in
oh = (ih + 2 * pad_h - kh)/sh + 1
ow = (iw + 2 * pad_w - kw)/sw + 1

# Deconvolution:
kernel = ic * oc * kh * kw
on = in
oh = (ih - 1) * sh + kh - 2 * pad_h
ow = (iw - 1) * sw + kw - 2 * pad_w

计算过程

deconv计算过程与conv过程类似,简单来说就是先根据stride补0,然后做卷积。

以input为3x3,kernel为3x3,stride =2举例:

im2col 与col2im

im2col,将卷积运算转换为矩阵运算,如下(篇幅原因,列按行来画):

col2im,逆过程,deconv过程也可以用col2im来运算:

##参考链接

https://github.com/vdumoulin/conv_arithmetic


Similar Posts

上一篇 quantization int8

下一篇 SSD网络

Content