liveBook · Manning

Reconstruction loss

As explained in Build a Text-to-Image Generator (from Scratch)

A reconstruction loss measures the discrepancy between input data and the data reconstructed from its latent representation.

Reconstruction loss measures the difference between an input image and the image reconstructed from its latent representation. It trains an encoder–decoder system to preserve useful visual information rather than merely compressing data. section 9.1.1 section 11.2.1

A typical image-reconstruction workflow proceeds as follows:

  • Pass an image through the encoder to obtain a latent representation. section 11.2.1
  • Decode the latent representation into a reconstructed image. section 9.1.1
  • Compare the original and reconstructed images; one described autoencoder uses mean absolute error across all pixels. section 11.2.1
  • Propagate the loss backward to update encoder and decoder parameters over repeated training epochs. section 11.2.1

The role of reconstruction loss changes across architectures. A traditional autoencoder focuses solely on reconstruction, whereas a VAE combines it with KL divergence to shape a smooth latent distribution. A VQ-VAE combines it with quantization loss after replacing continuous latent vectors with codebook entries. section 11.2.2 section 11.3.2

High-resolution image reconstruction

An image can be compressed from 3 × 512 × 512 pixels into a 4 × 64 × 64 latent representation, then decoded back to the original image space. Reconstruction loss evaluates how faithfully that decoding preserves the input. section 9.1.1

Figure 11.3 The architecture and training workflow of an autoencoder designed to generate high-resolution color images by using its two primary components: an encoder (shown on the left) and a decoder (shown on the right)

Use the architecture diagram to trace the encoder, latent vectors, decoder, pixel-wise loss, and parameter updates as one training loop. section 11.2.1

How Build a Text-to-Image Generator (from Scratch) covers it

How deep it goes
Explains pixel-wise mean absolute error, backpropagation, and its combination with KL divergence or quantization loss.
Examples
Uses high-resolution color images, pixel-wise mean absolute error, latent grids, and codebook-based VQ-VAE reconstructions.
What it assumes
Assumes familiarity with neural-network training, while defining encoders, decoders, latent vectors, and pixel differences through image examples.
What you can do after
Diagnose reconstruction quality by comparing original and decoded images and tracking the loss used for parameter updates.
How it connects
Connects autoencoders, variational autoencoders, latent representations, KL divergence, quantization loss, encoders, and decoders.

Also explained in

Compare how 10 books explain reconstruction loss →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build a Text-to-Image Generator (from Scratch). The section links point to the parts of the book it draws on.