Transposed Convolution Step by Step
Calculate a transposed convolution by spreading weighted contributions, offsetting them by the stride, and adding overlaps.
Transposed Convolution Step by Step explained visually
Calculate a transposed convolution by spreading weighted contributions, offsetting them by the stride, and adding overlaps.
What you will learn
Assign pixel labels and compare fully convolutional, U-Net, and SegNet decoders.
Understand weighted contributions
Imagine inspecting fabric for a damaged seam. A small feature map may indicate the general area of the damage. To produce a detailed segmentation map, the network needs a larger spatial representation.
Transposed convolution provides one way to build that representation using learned weights.
The main idea is that each input value contributes a weighted pattern to the output. When contributions overlap, they are added together.
Set the input, filter, and stride
Let us use a small example with a single row of values. Our input contains two and three. The filter weights are one, two, and one.
We use a stride of two, with no padding or bias.
Calculate and add the contributions
Start with the first input value, two. Multiply it by each filter weight. The resulting contribution is two, four, and two. Place these values into the first three output positions.
Now take the second input value, three. Multiplying it by the same weights gives three, six, and three.
Because the stride is two, this contribution begins two positions after the first contribution. It occupies the third, fourth, and fifth output positions.
The contributions overlap at the third position. The first contribution places a two there. The second contribution places a three there. Adding them gives five.
The final output is two, four, five, six, and three.
We have transformed two input values into five output values by spreading weighted contributions and adding their overlap.
Explain output size and information limits
For images, the same idea extends across rows and columns. During training, the filter weights are adjusted to help the network perform its task.
The output size depends on settings such as stride, filter size, and padding. A transposed convolution does not always double the dimensions.
It also does not exactly reverse information loss from earlier layers. It learns a useful transformation rather than automatically recovering every original value.
In the next lesson, we will place upsampling inside a complete segmentation architecture called U Net.
Quick check: test your understanding
What does input value 2 contribute with filter [1, 2, 1]?
[2, 4, 2].
What is the final output for input [2, 3], filter [1, 2, 1], stride 2, no padding, and no bias?
[2, 4, 5, 6, 3]. The overlapping middle contributions sum to 2 + 3 = 5.
Does transposed convolution always double size or recover all lost input information?
No. Output size depends on the settings, and the learned mapping is not a general inverse.
Accessible referenceLesson 60 transcript312 words · Matches the published narration and captionsOpen transcript
Imagine inspecting fabric for a damaged seam. A small feature map may indicate the general area of the damage. To produce a detailed segmentation map, the network needs a larger spatial representation. Transposed convolution provides one way to build that representation using learned weights. The main idea is that each input value contributes a weighted pattern to the output. When contributions overlap, they are added together.
Let us use a small example with a single row of values. Our input contains two and three. The filter weights are one, two, and one. We use a stride of two, with no padding or bias. Start with the first input value, two. Multiply it by each filter weight. The resulting contribution is two, four, and two. Place these values into the first three output positions.
Now take the second input value, three. Multiplying it by the same weights gives three, six, and three. Because the stride is two, this contribution begins two positions after the first contribution. It occupies the third, fourth, and fifth output positions. The contributions overlap at the third position. The first contribution places a two there. The second contribution places a three there. Adding them gives five.
The final output is two, four, five, six, and three. We have transformed two input values into five output values by spreading weighted contributions and adding their overlap. For images, the same idea extends across rows and columns. During training, the filter weights are adjusted to help the network perform its task.
The output size depends on settings such as stride, filter size, and padding. A transposed convolution does not always double the dimensions. It also does not exactly reverse information loss from earlier layers. It learns a useful transformation rather than automatically recovering every original value. In the next lesson, we will place upsampling inside a complete segmentation architecture called U Net.