liveBook · Manning

Decoder

As explained in Evolutionary Deep Learning: Genetic algorithms and neural networks

A decoder is a model component that maps an encoded representation back to an output, typically reconstructing the original input.

A decoder reconstructs an output from the latent representation produced by an encoder. In a convolutional autoencoder, it expands the compressed view back toward the original image. section 8.1.2 section 8.6

A convolutional decoder typically follows this sequence:

  • Apply convolutional layers to transform the latent view. section 8.1.2
  • Upsample after successive convolutions to reverse the spatial reduction caused by pooling. section 8.1.2
  • Finish with a convolutional layer that produces one channel for grayscale images or three channels for color images. section 8.1.2

Keras convolutional decoder

A compact decoder applies 16, 32, and 64-filter convolutions, each followed by 2×2 UpSampling, then emits a single-channel image with a final 3×3 convolution. The complete autoencoder uses Adam optimization and mean squared error loss. section 8.1.2

Listing 8.2 EDL_8_1_AE.ipynb: The decoder
decoded_layer1 = layers.Conv2D(16, (3, 3), activation='relu', 
 padding='same')(latent_view)                                               #1
decoded_layer1 = layers.UpSampling2D((2, 2))
 (decoded_layer1)                                                           #2
decoded_layer2 = layers.Conv2D(32, (3, 3), 
 activation='relu', padding='same')(decoded_layer1)                         #1
decoded_layer2 = layers.UpSampling2D((2, 2))
 (decoded_layer2)                                                           #2
decoded_layer3 = layers.Conv2D(64, (3, 3), activation='relu')(decoded_layer2) #1
decoded_layer3 = layers.UpSampling2D((2, 2))
 (decoded_layer3)                                                           #2
 
output_layer   = layers.Conv2D(1, (3, 3), 
 padding='same')(decoded_layer3)                                            #3

Inspect the executable decoder definition, including convolution, UpSampling, and output-channel configuration. section 8.1.2

How Evolutionary Deep Learning: Genetic algorithms and neural networks covers it

How deep it goes
Explains convolution and UpSampling layer order, output channels, and model compilation, but leaves detailed training code unexplored.
Examples
Uses a Fashion-MNIST convolutional autoencoder with three convolution-UpSampling stages and a single-channel output.
What it assumes
Assumes an encoder and latent view already exist, while demonstrating how to rebuild the original image from that compressed representation.
What you can do after
Build it from scratch in Keras by chaining convolutional, UpSampling, and output layers into an autoencoder.
How it connects
Ties decoder to encoder, latent representation, convolutional layers, pooling, UpSampling, and autoencoders.

Also explained in

Compare how 5 books explain decoder →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Evolutionary Deep Learning: Genetic algorithms and neural networks. The section links point to the parts of the book it draws on.