Reconstruction loss measures the pixel-level mismatch between an input image and its reconstruction. Training adjusts the encoder and decoder to minimize this difference, bringing reconstructed images closer to their originals. section 7.2.2 section 7.0
For an autoencoder, reconstruction loss is the main objective. A VAE adds KL divergence, which regularizes the latent distribution toward a standard normal while reconstruction loss preserves input detail. section 7.3.1 section 7.3.2
A typical image-reconstruction training step proceeds as follows:
- Feed a batch of original images through the encoder and decoder. section 7.2.2
- Compare each reconstructed pixel with the corresponding original pixel, square the differences, and average them to obtain mean squared error. section 7.2.2
- Backpropagate the loss and update model parameters with Adam. section 7.2.2
Handwritten-digit autoencoder
A 28×28 grayscale digit is flattened into 784 values, compressed to a 20-value representation, and decoded back into 784 pixels. Before training, reconstructions appear as noise; minimizing pixel-wise squared error makes them increasingly resemble the originals. section 7.0









