Three image generative models implemented from scratch in PyTorch, one per homework of ECE 285 (UCSD). Each folder has its own README with the architecture, hyperparameters, training curves and usage, a model/ package, a training notebook and a generate_images.ipynb notebook.
| Model | Dataset | Resolution | Inception Score | Details |
|---|---|---|---|---|
| Variational Autoencoder | Chest X-ray (11,712 images) | 224 x 224 | 2.24 | VAE/ |
| GAN (non-saturating loss + R1) | WikiArt (81,444 paintings) | 128 x 128 | 5.57 | GANs/ |
| Diffusion (DDPM, DDIM sampling) | Histopathology (5,179 patches) | 128 x 128 | 3.33 | Diffusion/ |
All metrics were computed with PyTorch-Ignite. The GAN and diffusion results use 1,000 generated images, while the VAE used only 32 per evaluation, so its score is noisier. The models are trained on different datasets, so the numbers describe each model on its own dataset rather than rank the models against each other.
| VAE | GAN | Diffusion |
|---|---|---|
![]() |
![]() |
![]() |
- VAE: a convolutional encoder predicts the mean and log-variance of a 512-d latent, and an upsampling decoder reconstructs the image. It is trained with reconstruction loss + 0.1 x KL. Compares an upsampling decoder with a transposed-convolution decoder.
- GAN: an upsampling generator (3.4M parameters) and a convolutional discriminator (7.2M), trained for 100 epochs with the non-saturating loss and a lazy R1 gradient penalty instead of BatchNorm or spectral norm in D.
- Diffusion: a 25.9M-parameter U-Net with ResBlocks and self-attention predicts the added noise, with a cosine schedule over 1000 steps. Trained for 150 epochs with an EMA of the weights. Images are sampled with full DDPM or 50-step DDIM.
The notebooks download their datasets with kagglehub. Checkpoints (checkpoints/) and wandb logs (wandb/) are not tracked in git. Train with the *_experiments.ipynb notebook in each folder, then run its generate_images.ipynb to sample from a checkpoint.


