What is a transposed convolution?
A transposed convolution is a learnable operation that can increase the height and width of a CNN feature map. It is commonly used in decoder networks to turn small, coarse feature maps into larger ones.
How does it work?
- A standard convolution with stride greater than 1 often reduces spatial resolution.
- A transposed convolution with stride greater than 1 can increase spatial resolution while learning how to combine features.
- Conceptually, it can be understood as spacing input values apart and applying learned convolutional filters; overlapping contributions are added together.
Although it is sometimes called *deconvolution*, it is not the mathematical inverse of convolution and cannot automatically recover information lost during downsampling.
Practical example
Suppose a CNN decoder receives 16 feature channels of size `4×4`. We want to produce 8 channels of size `8×8`.
Use this PyTorch layer:
nn.ConvTranspose2d(16, 8, kernel_size=4, stride=2, padding=1)
- Input shape:
(1, 16, 4, 4)(batch, channels, height, width). - Output shape:
(1, 8, 8, 8). - For dilation
1and output padding0, the spatial size is(4 - 1) × 2 - 2 × 1 + 4 = 8.
Thus, the layer doubles height and width while learning how to construct the larger feature maps.
Where is it useful?
- Image segmentation: Decoder layers recover a higher-resolution prediction from compact image features.
- Autoencoders: A decoder expands compressed feature maps.
- Image generators: Learned upsampling turns lower-resolution representations into images.
Important limitation: Certain kernel/stride combinations can create uneven overlap and checkerboard artifacts. A common alternative is interpolation followed by an ordinary convolution; the next questions compare these approaches.
Related: “What is a convolutional layer?” and “What is a feature map in a CNN?”
Research: A guide to convolution arithmetic for deep learning. Documentation: PyTorch ConvTranspose2d.
Sources & Research References
Learning Sequence
Deep Learning Curriculum
How does transposed convolution differ from interpolation-based upsampling?
Explore Related Questions
Deepen your understanding across related Deep Learning topics.