Calculation formulas for convolution, atrous convolution, deconvolution and atrous deconvolution (full)

Foreword:

Commonly used convolutions include convolution, atrous convolution, deconvolution and atrous deconvolution. Their calculation formulas are summarized below.

1. Convolution calculation formula

The calculation formula of the convolutional network is:
N=(W-F+2P)/S+1
where
N: output size
W: input size
F: convolution kernel size
P: size of padding value
S: step size

2. Atrous convolution

d = dilation

1. Receptive field calculation. Assuming that the original convolution kernel size is k, then the receptive field size of the convolution kernel after stuffing (d - 1) spaces is:

 

 2. Feature map size calculation. Assuming that the size of the input atrous convolution is i and the step size is s, the calculation formula of the feature map size o after atrous convolution is:

3. Deconvolution calculation formula

in_size = 64
S = 2 # stride
K = 3 # kernel_size
P = 2 # padding
output_padding = 1
out_size = (in_size - 1) * S + K - 2*P + output_padding
print(out_size)

4. Atrous deconvolution calculation formula

in_size = 64
S = 2 # stride
K = 3 # kernel_size
P = 2 # padding
D = 2 # dilation
output_padding = 1
out_size = (in_size - 1) * S + K - 2*P/D + output_padding
print(out_size)

Guess you like

Origin blog.csdn.net/weixin_44503976/article/details/127754679