This project explores conditional face generation with a Conditional Variational Autoencoder (CVAE) trained on CelebA. The model learns to generate and edit face images based on a vector of binary facial attributes.
- Generates new faces from a latent vector and attribute set
- Reconstructs CelebA faces from the encoder-decoder pipeline
- Edits selected attributes such as
Male,Eyeglasses,Blond_Hair, andSmiling - Compares different beta values to show the reconstruction vs. generation trade-off
main.py- experiment entry point, training, generation, and reconstruction exportsrc/model.py- CVAE and the alternative fully connected CVAE2 modelsrc/train.py- training loop, beta warm-up, and evaluation helperssrc/utils.py- generation, reconstruction, editing, and interpolation utilitiesprojekt.ipynb- results, experiments, analysis, and figures used in the presentation
The project uses the CelebA dataset with 40 binary attributes. Images are loaded through src/dataset.py, resized for training, and normalized to the [-1, 1] range.
The current configuration is stored in config.yaml and controls:
- latent size
- image resolution
- beta value
- batch size
- number of epochs
- training subset size
main.py reads the config file, trains the model, saves the checkpoint, and exports generated samples and reconstructions to experiments/.
The repository already contains saved experiment folders with:
- model checkpoints
- training histories
- reconstruction figures
- generated samples
These artifacts are used by the notebook and presentation slides.
Install dependencies:
pip install -r requirements.txtRun training and export the latest experiment outputs:
python main.pyThe run will create a folder under experiments/ with the current config name and save:
model.pthhistory.json- generated face grids
- reconstruction plots
projekt.ipynb is the analysis notebook. It collects:
- reconstruction examples
- attribute interpolation results
- attribute editing examples
- latent-space experiments
- beta trade-off observations
- Some attributes are still weakly controlled
- Fine facial details are blurred
- Rare attribute combinations are harder to generate