Building a Convolutional Generative Adversarial Network (CNN GAN) in PyTorch that learns to generate handwritten digits from random noise.
• Two networks compete — a Generator that maps 100-d noise → 28×28 digit
image, and a Discriminator that classifies real vs. fake MNIST digits
• No labels used — the only training signal is the adversarial competition
• Generator: dense projection → 7×7 spatial seed → 2× upsample-conv blocks→ Tanh output at 28×28
• Discriminator: 3 strided convolutional stages → single real/fake score
• Loss: Binary Cross-Entropy, alternating D and G updates each epoch
• Label smoothing (0.9) to prevent discriminator overconfidence
• DCGAN weight initialization — Conv/Linear ~ N(0, 0.02)
• Batch size 64 for more stable gradient estimates
• Fixed evaluation noise — same 25 latent codes tracked across all checkpoints
• Trained for 10,000 epochs; recognizable digits emerge by epoch ~400
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
GitHub: https://github.com/cdd369/CPSC5440/tree/main/assignment_5
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━