Denoising Diffusion Probabilistic Models
Paper β’ 2006.11239 β’ Published β’ 9
A class-conditional Denoising Diffusion Probabilistic Model (DDPM) trained on a dataset of 16x16 pixel sprites. The model can generate sprites conditioned on one of 5 class labels.
This model implements DDPM (Ho et al., 2020) with a ContextUnet backbone that conditions the denoising process on class labels via context embedding. The architecture uses residual blocks with skip connections and a U-Net-style encoder-decoder structure.
Down path:
UnetDown: two stacked ResidualBlocks followed by MaxPool2d(2)Bottleneck:
ResidualBlock with is_res=True (residual shortcut)Up path:
UnetUp: ConvTranspose2d(in, out, 2, 2) for upsampling, followed by two ResidualBlocks; skip connection from corresponding down-path output is concatenated before upsamplingContext conditioning:
ResidualBlock:
Conv2d(3x3) + BatchNorm2d + GELU blocks; residual shortcut (with optional 1x1 projection) when is_res=True; output scaled by 1/sqrt(2) for stable trainingbeta1=1e-4 to beta2=0.02 over T=500 timestepsa_bt = cumprod(1 - b_t) (cumulative product of alpha values)x_t = sqrt(a_bt[t]) * x_0 + sqrt(1 - a_bt[t]) * noise| Parameter | Value |
|---|---|
| Dataset | 1788 sprites, 16x16 RGB (sprites_1788_16x16.npy) |
| Class labels | 5 classes (sprite_labels_nc_1788_16x16.npy) |
| Epochs | 60 |
| Timesteps (T) | 500 |
| Batch size | 100 |
| Learning rate | 1e-3 (linear decay over epochs) |
| Optimizer | Adam |
| Input normalization | Normalize(0.5, 0.5) β [-1, 1] |
| Feature channels | n_feat=64, n_cfeat=5 |
| File | Epoch |
|---|---|
| checkpoints/model_Epoch20.pth | 20 |
| checkpoints/model_Epoch30.pth | 30 |
| checkpoints/model_Epoch31.pth | 31 |
| File | Description |
|---|---|
| models.py | ContextUnet, UnetDown, UnetUp, ResidualBlock |
| train.py | Training loop with DDPM noise schedule |
| utils.py | CustomDataset, helper transforms |
| model.ipynb | Notebook version |
| sprites_1788_16x16.npy | Sprite image data |
| sprite_labels_nc_1788_16x16.npy | Class label data |
MIT