Udacity Deep Learning Nanodegree (nd101) — Course 5: Building Generative Adversarial Networks, final project.
Train a Deep Convolutional GAN from scratch on CelebA faces (64×64).
Standard DCGAN (Radford et al. 2015):
- Generator: z(100) → 4×4×512 → 8×8 → 16×16 → 32×32 → 64×64×3 (Tanh)
- Discriminator: 64×64×3 → 32×32 → 16×16 → 8×8 → 4×4 → logit (LeakyReLU + BatchNorm)
- Loss: BCE with logits
- Optimizer: Adam(lr=2e-4, β₁=0.5)
- Init: Normal(0, 0.02)
| Epoch | Avg lossG | Avg lossD | Time |
|---|---|---|---|
| 1 | 15.73 | 0.34 | 130s |
| 2 | 12.08 | 0.86 | 109s |
| 3 | 5.55 | 0.83 | 124s |
Generated faces are recognizable (hair, skin tone, basic facial structure) — more epochs on the full 162K dataset sharpens features further.
- Python 3.14 / PyTorch 2.10 / MPS backend
- HuggingFace
datasetsfor CelebA loading (tpremoli/CelebA-attrs)
pip install torch torchvision datasets matplotlib
BATCH=64 EPOCHS=3 SUBSET=5000 python run_gan.pyproject.ipynb/project.html— submission notebook with loaded generator + sample imagesrun_gan.py— full training scriptsamples/samples_ep0N.png— face grids per epochloss_curve.png— G vs D loss over trainingcheckpoints/— generator.pt + discriminator.pt (ignored; regenerate withrun_gan.py)
Part of Leo's Udacity Masters in AI journey. See also:
- landmark-classifier — Course 3 CNN
- text-translation-sentiment — Course 4 Transformers