upsampling
Some commonly used upsampling methods:
Nearest neighbor interpolation, single linear interpolation, bilinear interpolation, deconvolution, and unpooling .
Nearest neighbor interpolation: directly map the pixel with the nearest coordinates to the output image.
10 | 20 | 30 |
15 | 25 | 35 |
20 | 25 | 30 |
10 | 20 | 30 | 30 |
15 | 25 | 35 | 35 |
20 | 25 | 30 | 30 |
20 | 25 | 30 | 30 |
Single linear interpolation:
The coordinates of P1 and P2 are known, and the coordinates are (X1, Y1) and (X2, Y2) respectively. It is necessary to calculate the y value of x on the straight line at a certain position in the [X1, X2] interval.
Then after simplifying
Y1 and Y2 respectively represent the pixel values in the image, and the formula can be rewritten as
Bilinear interpolation:
Bilinear interpolation has four known variables. Q11, Q12, Q22, and Q21 use linear interpolation method to calculate R1 and R2 respectively, and then use linear interpolation method to calculate P.
deconvolution
Deconvolution is also called transposed convolution (Transposed Convolution)
First let's look at the operation of forward convolution.
Convolution transforms the 4x4 matrix into a 2X2 matrix.
Now deconvolution reverses this operation and converts the 2X2 matrix into a 4X4 matrix.
About to invert the 3x3 convolution kernel
Rearrange the convolution kernels, 1 4 1 -0- 1 4 3 -0- 3 3 1 -0- 0 0 0 -0-
Finally, the 4x16 convolution kernel is transposed, and the 2X2 output matrix is also flattened.
Different convolution parameters correspond to different deconvolution operations.
anti-pooling
Pooling is divided into max pooling and mean pooling
mean pooling
max pooling