Portfolio Project
Synthetic Digit Generator
Variational Autoencoder
Context
I wanted to generate new handwritten digits, not just recognize them.
Approach
- Trained a Variational Autoencoder (VAE) on MNIST (60,000 handwritten digits).
Impact
- Generated new digits by sampling the learned latent space.
- Saved the trained model so generation is a quick inference step.
Model Architecture (VAE)
I trained a VAE to learn a compact latent space for handwritten digits and generate new samples from it.
- Encoder: CNN that maps an image to a latent mean and variance.
- Reparameterization trick to sample during training while keeping gradients stable.
- Decoder: transposed convolutions that reconstruct an image from a latent vector.
Training and Sampling
- Trained on MNIST and balanced reconstruction loss vs. KL divergence.
- Validated by comparing original vs. reconstructed digits and sampling random latent vectors.
- Saved the model so generation doesn't require retraining.
Latent Space Analysis
- Used PCA, t-SNE, and UMAP to visualize how digits cluster in latent space.
- Applied clustering (HDBSCAN/DBSCAN) to study structure and spot outliers.
- Checked reconstruction error to see which digits are hardest to model.
What I'd Improve
- Build a conditional VAE so I can generate a specific digit on demand.
- Improve sample sharpness with stronger decoders or better loss functions.
- Add quantitative metrics (FID-like proxies) to compare models over time.