A reproducible, from-scratch pixel-space diffusion study for data-efficient, fine-grained generation on the 196-class Stanford Cars dataset. The repository contains the training and evaluation code, frozen experiment configurations, aggregate metrics, audit reports, and generated samples from the completed 30,000-step experiments.
The project is an experimental baseline, not a state-of-the-art generation claim. Its strongest model still has limited visual fidelity and weak class consistency; the negative 128x128 result is preserved as part of the evidence.
The selected generator is the 64x64 E4 model with EMA weights, classifier-free guidance 4, Min-SNR gamma 5, and DDIM-100 sampling.
| Resolution | DDIM steps | FID ↓ | KID ↓ | Precision ↑ | Recall ↑ | Class Top-1 ↑ | Class Top-5 ↑ | Images/s ↑ |
|---|---|---|---|---|---|---|---|---|
| 64 | 20 | 251.3306 | 0.300601 | 0.000000 | 0.0164 | 0.0246 | 0.0700 | 21.92 |
| 64 | 50 | 182.0932 | 0.206997 | 0.000373 | 0.0199 | 0.0373 | 0.0943 | 9.23 |
| 64 | 100 | 124.2399 | 0.136784 | 0.002985 | 0.0221 | 0.0505 | 0.1361 | 4.56 |
| 128 | 50 | 265.3183 | 0.299517 | 0.000000 | 0.0000 | 0.0138 | 0.0585 | 3.20 |
Increasing the 64x64 DDIM budget from 20 to 100 steps improves FID from 251.33 to 124.24 while reducing throughput from 21.92 to 4.56 images/s. At the matched DDIM-50 setting, the 128x128 extension is worse than the 64x64 model: FID rises by 45.7%, class Top-1 falls by 63.0% relative, and sampling is 2.89 times slower.
Machine-readable values and the complete interpretation are available in
final_results.json and the
Chinese final report.
These grids contain generated outputs, not redistributed Stanford Cars source images. They show why the 64x64 model was retained and why the direct 128x128 extension was rejected.
| Final 64x64 training sample | Final 128x128 training sample |
|---|---|
![]() |
![]() |
The full class-representative sheets cover all 196 labels:
- 64x64 classes 0–63, 64–127, and 128–195
- 128x128 classes 0–63, 64–127, and 128–195
- Best/worst and high-confidence diagnostic grids
- More DDIM steps consistently improve measured 64x64 quality, with a large throughput cost.
- A direct 128x128 scale-up fails under the executed protocol and should not replace the frozen 64x64 model.
- Class conditioning is the primary bottleneck: generated-image Top-1 reaches only 5.05%, while the frozen classifier reaches 58.70% on real images downsampled to 64 and then resized to its input resolution.
- All 8,041 generated outputs in the final 64x64 DDIM-50 audit have unique SHA-256 and dHash values. This argues against exact duplication, but does not prove that the model never memorizes training examples.
- The official dataset split contains 19 test rows whose source-image hashes overlap the training set. Removing those rows changes DDIM-100 FID by only +0.0014, leaving the conclusion unchanged.
The training protocol uses 8,144 official training images and 8,041 official
test images across 196 classes. Bounding boxes are expanded by 10% before image
normalization. The checked dataset manifests are versioned under
data/manifests; raw images and processed crops are not
distributed here.
| Stage | Change | Outcome |
|---|---|---|
| E1 | Unconditional 64x64 baseline | Established the 30k-step reference |
| E2 | Bounding-box crops | Improved object framing |
| E3 | Class conditioning and CFG sweep | Identified guidance trade-offs |
| E4 | Min-SNR, EMA, CFG=4 | Selected final 64x64 method |
| E6a–c | MAFP and translation variants | Did not replace E4 under matched budgets |
| Final 128 | Direct 128x128 extension | Rejected because quality and speed regressed |
Stage-specific reports are available under reports, and aggregate
JSON metrics are under metrics. Large Clean-FID feature caches are
excluded.
code/carsdiff/ Dataset, augmentation, diffusion, model, and reproducibility code
code/scripts/ Training, sampling, evaluation, audit, and reporting commands
code/tests/ Unit tests for the core pipeline
configs/ Frozen YAML configurations for E1–E6 and final runs
data/manifests/ Dataset checksums and integrity audit summaries
env/ Reproducible package and Conda environment locks
metrics/ Lightweight aggregate evaluation results
reports/ Experiment notes, final delivery, EDA, and generated grids
samples/ Curated training-progress grids for the final models
The reference environment uses Python 3.11 and is recorded in
env/requirements.lock.txt and
env/conda-explicit.txt.
source env.sh
bash code/scripts/setup_env.sh
python -m pytest -q code/testsThe path configuration keeps datasets, checkpoints, samples, metrics, logs, and
caches under the project root. To override the location, set PROJECT_ROOT
before sourcing env.sh.
source env.sh
python code/scripts/prepare_data.py --source zip
python code/scripts/eda.py
python code/scripts/train.py --config configs/final_e4_official_train_64_30k.yamlSampling and post-processing entry points are documented in
code/scripts. Model checkpoints are intentionally excluded;
the final report records their original server-relative paths for provenance.
The public repository excludes:
- the Stanford Cars source images and processed crops;
- 55 GB of model checkpoints;
- Python/Conda environments and download caches;
- Clean-FID feature arrays and real-image evaluation caches;
- logs, temporary files, and third-party paper/source archives.
The generated grids are retained as experiment evidence. Final results use one training seed per generator configuration, so no mean, standard deviation, or training-seed significance claim is made. The 128x128 run also changes batch size and therefore is not a compute-matched architecture ablation.
The course/experimental project is complete and reproducibly archived. It is not yet method-paper ready: multi-seed training, compute-matched modern baselines, human evaluation, and stronger class conditioning remain open work.



