liveBook · Manning

Compression

As explained in Local Image Generation

A technique for representing an image with fewer data while retaining enough information for reconstruction.

Compression shrinks an image before Stable Diffusion does its heavy computational lifting. A Variational Autoencoder (VAE) learns how to preserve useful information while allowing imperfect reconstruction. section 4.3.1

A VAE handles compression in two steps:

  • Encoding turns an image into a smaller representation called the latents. section 4.3.1
  • Decoding runs the process in reverse, reconstructing an image from the latents. section 4.3.1
  • Unlike JPEG or ZIP, a VAE learns compression for a specific balance of file-size reduction and generalization. section 4.3.1

Imperfect memory helps

A child drawing a house from memory cannot reproduce every detail, so the result becomes a general house rather than one exact house. Compression uses a similar trade-off: losing some information can help the model generalize. section 4.3.1

Figure 4.11 Closer look at the variational autoencoder.

Use the diagram to follow how the VAE connects image input, latent representation, and reconstructed output. section 4.3.1

How Local Image Generation covers it

How deep it goes
Explains encoding into latent space and decoding back into images, with practical motivation rather than implementation details.
Examples
Uses JPEG and ZIP comparisons plus a child’s imperfect house drawing to illustrate compression and generalization.
What you can do after
Understand why Stable Diffusion compresses images into latents before performing most of its work.
How it connects
Connects compression to variational autoencoders, latent space, encoding, decoding, generalization, and Stable Diffusion.

Also explained in

Compare how 15 books explain compression →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Local Image Generation. The section links point to the parts of the book it draws on.