Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Making images bigger
A classifier shrinks an image down to a label; a segmentation or image-generation network must grow small feature maps back to full size. A transposed convolution does this by letting every input value “stamp” a small learned pattern onto a bigger canvas, with the stamps spaced apart and overlapping. Simpler options are to enlarge the map with a fixed rule (nearest or bilinear) and then convolve, or to compute several channels and rearrange them into extra pixels (pixel shuffle).
Upsampling layers produce the pixels you see in segmentation masks, depth maps, super-resolved satellite images and generated images. Poor choices leave checkerboard patterns that can fool downstream processing, so choosing and initialising them well matters.
- 1. A transposed convolution…
- 2. Pixel shuffle turns…
- 3. A common artefact of transposed convolutions is…
Level 1: Beginner
★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.By hand
- Transposed convolution output size: (n − 1)s − 2p + k + output_padding. Examples:
- n = 4, k = 3, s = 2 → 9;
- n = 7, k = 4, s = 2, p = 1 → 14;
- n = 14, k = 3, s = 2, p = 1, output_padding = 1 → 28.
- Overlap (1-D): three inputs, k = 3, s = 2 give coverage counts 1, 1, 2, 1, 2, 1, 1 (uneven); with k = 4: 1, 1, 2, 2, 2, 2, 1, 1 (even inside). Overlap is even in the interior exactly when k is divisible by s.
- Nearest upsampling by 2: [1, 2] → [1, 1, 2, 2] in each row and column.
- Pixel shuffle: a convolution produces C·r² channels at low resolution, then they are rearranged into C channels at r times the resolution: 12 channels for an RGB image at r = 2.
- 1. Output size for n = 7, k = 4, s = 2, p = 1:
- 2. Is overlap even for k = 3, s = 2?
- 3. Channels needed for pixel shuffle to RGB at r = 2:
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 20 minUndergraduate students and practising engineers.Upsampling in code
Exercise 1.
- The inner products ⟨conv(x), y⟩ and ⟨x, conv_transpose(y)⟩ agreed, confirming that the transposed convolution is the adjoint of the strided convolution; it mapped 4 × 4 back to 9 × 9.
- Pixel shuffle placed channel 0, 1, 2 and 3 values in the four phases of each 2 × 2 output block.
Practice.
nn.ConvTranspose2d(C_in, C_out, k, stride, padding, output_padding); choose k divisible by s (for example k = 4, s = 2, p = 1 doubles the size exactly).- Alternatively
nn.Upsample(scale_factor=2, mode="nearest")followed bynn.Conv2davoids checkerboards (Odena et al., 2016). - For super-resolution,
nn.PixelShuffle(r)after a convolution with C·r² outputs; initialise with ICNR (copying one phase’s kernel to all phases) to avoid initial artefacts.
up = torch.nn.Sequential(torch.nn.Upsample(scale_factor=2, mode="nearest"), torch.nn.Conv2d(64, 32, 3, padding=1))- 1. A checkerboard-free alternative is…
- 2. ICNR initialisation is for…
- 3. The transposed convolution is also…
Level 3: Advanced
★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.Theory
Adjoint. A strided convolution is a linear map y = Cx. Its transpose Cᵀ maps the output space back to the input space; backpropagation through the convolution computes exactly Cᵀ applied to the output gradient. A transposed-convolution layer is Cᵀ with learnable weights, which is why the operation is not an inverse (“deconvolution” in the signal-processing sense).
Checkerboards. In a transposed convolution with stride s, each output pixel receives contributions from a number of kernel taps that depends on its position modulo s. When k is not divisible by s, these counts differ between phases, so even a constant input produces a periodic pattern. When counts are equal, different phases still use different subsets of weights, so random or poorly trained kernels still create patterns, more weakly (exercise 2).
Resize-convolution. Nearest or bilinear resizing produces a smooth or piecewise-constant image with no phase dependence, and the following convolution is shift-equivariant, so no checkerboard can arise from a constant input.
Pixel shuffle is equivalent to a transposed convolution with stride r and a particular kernel arrangement; it is efficient because all computation happens at low resolution (Shi et al., 2016).
- 1. "Deconvolution" layers are really…
- 2. Even overlap removes checkerboards from…
- 3. Pixel shuffle is efficient because its computation is at…
Level 4: Expert
★★★★★ Expert⏱ 25 minResearchers: original papers and open problems.Checkerboard artefacts
History.
- M. Zeiler et al. (2010) used “deconvolutional” networks; J. Long, E. Shelhamer and T. Darrell (2015) used learned upsampling in FCNs.
- W. Shi et al. (2016) introduced the efficient sub-pixel convolution (pixel shuffle).
- A. Odena, V. Dumoulin and C. Olah (2016) explained checkerboard artefacts and recommended resize-convolution.
- A. Aitken et al. (2017) proposed ICNR initialisation.
Exercise 2. A constant 12 × 12 image upsampled by 2 with random positive kernels (as at the start of training); checkerboard strength is the standard deviation of the four phase means divided by the overall mean, averaged over 200 draws:
| method | checkerboard strength |
|---|---|
| transposed convolution, k = 3, s = 2 | 0.498 |
| transposed convolution, k = 4, s = 2 | 0.124 |
| pixel shuffle (sub-pixel convolution) | 0.076 |
| nearest upsampling + 3 × 3 convolution | 0.000 |
- Uneven overlap (k = 3, s = 2) gave a strong checkerboard.
- Even overlap (k = 4) and pixel shuffle reduced it but did not remove it, because different output phases still use different weights.
- Resize-then-convolve produced none. Training can learn to suppress artefacts, but avoiding them by design is more reliable.
Upsampling in AI, robotics and aerospace
- Segmentation and depth decoders for robot and vehicle perception (U-Net, E10-2).
- Super-resolution of satellite and aerial imagery with pixel-shuffle networks.
- Generative models for simulation and data augmentation, where artefacts can bias downstream detectors.
References
- V. Dumoulin, F. Visin (2016). “A guide to convolution arithmetic for deep learning.” arXiv:1603.07285.
- A. Odena, V. Dumoulin, C. Olah (2016). “Deconvolution and checkerboard artifacts.” Distill.
- W. Shi et al. (2016). “Real-time single image and video super-resolution using an efficient sub-pixel convolutional neural network.” Proc. CVPR.
- A. Aitken et al. (2017). “Checkerboard artifact free sub-pixel convolution.” arXiv:1707.02937.