How does strided deconvolution works?

3

I am trying to understand how the shape of the image changes after deconvolution ? I am trying to understand the example code of convolutional autoencoder from neon.

layers = [Conv((4, 4, 8), init=init_uni, activation=Rectlin()),
          Pooling(2),
          Conv((4, 4, 32), init=init_uni, activation=Rectlin()),
          Pooling(2),
          Deconv(fshape=(3, 3, 8), init=init_uni, strides=2, padding=1),
          Deconv(fshape=(3, 3, 8), init=init_uni, strides=2, padding=1),
          Deconv(fshape=(4, 4, 1), init=init_uni, strides=2, padding=0)]

The input_shapes and output_shapes of each layer are as follows

Convolution Layer 'ConvolutionLayer': 1 x (28x28) inputs, 8 x (25x25) outputs, padding 0, stride 1
Pooling Layer 'PoolingLayer': 8 x (25x25) inputs, 8 x (12x12) outputs
Convolution Layer 'ConvolutionLayer': 8 x (12x12) inputs, 32 x (9x9) outputs, padding 0, stride 1
Pooling Layer 'PoolingLayer': 32 x (9x9) inputs, 32 x (4x4) outputs
Deconvolution Layer 'DeconvolutionLayer': 32 x (4x4) inputs, 8 x (7x7) outputs
Deconvolution Layer 'DeconvolutionLayer': 8 x (7x7) inputs, 8 x (13x13) outputs
Deconvolution Layer 'DeconvolutionLayer': 8 x (13x13) inputs, 1 x (28x28) outputs

I understand how the shapes change after convolution ('valid'). (Thanks to http://cs231n.github.io/convolutional-networks/) How does the stride affect the size of matrix when deconvolution (full convolution) is used ?

Ankitp

Posted 2015-12-05T10:24:32.533

Reputation: 131

See also: What are deconvolutional layers?

– Martin Thoma – 2016-11-22T21:29:47.450

Check out my answer here for your question.

– Yash Katariya – 2017-07-20T08:32:36.887

Answers

1

The strided deconvolution is expanding the size of the layer (you can think of it as undo-ing the effect of the pooling without doing unpooling).

Check out slide 18 here. That might help.

user3487187

Posted 2015-12-05T10:24:32.533

Reputation: 11

1

Upsampling or deconvolution layer is used to increase the resolution of the image. In segmentation, we first downsample the image to get the features and then upsample the image to generate the segments.

For deconvolution operation we pad the image with zeroes and then do a convolution operation on that, hence it is upsampled.

For eg: - If after downsampling the images becomes [[1, 1] [1, 1]]

Then if we pad it with zeroes, [[0, 0, 0, 0, 0, 0] [0, 0, 0, 0, 0, 0] [0, 0, 1, 1, 0, 0] [0, 0, 1, 1, 0, 0] [0, 0, 0, 0, 0, 0] [0, 0, 0, 0, 0, 0]]

Now, if we do convolution on the above image with a 3 x 3 filter, we will get an image of shape (4, 4). Thus we upsampled an image of shape (2, 2) to (4, 4).

Yash Katariya

Posted 2015-12-05T10:24:32.533

Reputation: 421

Is the upampled image like the input to the convolution? I mean is the reconstructed (4, 4) image like the original one? – Media – 2017-12-23T12:44:24.963