Image Generation — GANs

A GAN is two neural networks in a fixed game. One draws, one critiques. They get better together until the drawings fool the critic.

Build 1.3 hr Python

Prerequisites: Phase 4 Lesson 03 (CNNs), Phase 3 Lesson 06 (Optimizers), Phase 3 Lesson 07 (Regularization)

#Learning Objectives

  • Explain the minimax game between generator and discriminator and why the equilibrium corresponds to p_model = p_data
  • Implement a DCGAN in PyTorch and get it to generate coherent 32x32 synthetic images in under 60 lines
  • Stabilise GAN training with the three standard tricks: non-saturating loss, spectral norm, TTUR (two-timescale update rule)
  • Read training curves that distinguish healthy convergence from mode collapse, oscillation, and discriminator-wins-completely
Full Access lesson

Keep going. The rest of this lesson is one step away.

Unlock all 503 lessons, video, code, quizzes and every future update. Pay in your own currency with Paystack.

The text and code of this lesson are based on AI Engineering from Scratch by Rohit Ghumare, MIT licensed.