Aller au contenu
ModelPrésentéExterne
Télécharger

VAE CelebA

This repository contains a trained Variational Autoencoder (VAE) model on the CelebA dataset. The model is designed to encode and decode facial images, enabling tasks such as image reconstruction, latent space...

TypeVAEVersionvae_celeba_latent_200_epochs_10_batch_64_subset_80000CClasse

Source du modèle

Type
VAE
Taille du fichier
14,7 MB
Version
vvae_celeba_latent_200_epochs_10_batch_64_subset_80000
Mis à jour
20 oct. 2026
Source
Hugging Face

Description de la source

Variational Autoencoder (VAE) - CelebA Dataset

This repository contains a trained Variational Autoencoder (VAE) model on the CelebA dataset. The model is designed to encode and decode facial images, enabling tasks such as image reconstruction, latent space interpolation, and attribute manipulation.

Model Details

  • Architecture: Variational Autoencoder (VAE)
  • Dataset: CelebA
  • Latent Dimension: 200
  • Training Subset Size: 80,000 images
  • Batch Size: 64
  • Learning Rate: 1e-3
  • Epochs: 10

Weights and Biases Run

The training process was tracked using Weights and Biases. You can view the full training logs and metrics here.

Usage

Loading the Model

To load the trained model, use the following code snippet:

import torch
from vae_model import VAE  # Ensure the VAE class is defined in vae_model.py

# Define the latent dimension
latent_dim = 200

# Initialize the model
model = VAE(latent_dim=latent_dim)

# Load the trained weights
model_path = "./vae_celeba_latent_200_epochs_10_batch_64_subset_80000.pth"
model.load_state_dict(torch.load(model_path))
model.eval()

Applications

  1. Image Reconstruction: Reconstruct input images using the encoder and decoder.
  2. Latent Space Interpolation: Generate smooth transitions between two images by interpolating in the latent space.
  3. Attribute Manipulation: Modify specific attributes (e.g., smiling, hair color) by moving along attribute directions in the latent space.

Example Results

Reconstruction

Below is a reconstruction example where the first row represents the original images, and the second row represents the reconstructed images:

Reconstruction

Latent Space Interpolation

Below is an example of interpolating between two images in the latent space:

Latent Space Interpolation

Attribute Manipulation

Manipulating the "Smiling" attribute in the latent space:

Attribute Manipulation

License

This project is licensed under the MIT License. See the LICENSE file for details.

Sources

1 source
Hugging FacePrincipalVersion 9e5ed327c2d4dff8a702cff3a1b8e829969e42b8
huggingface.co/hussamalafandi/VAE-CelebA/tree/9e5ed327c2d4dff8a702cff3a1b8e829969e42b8

Vérifié 20 oct.

Artefacts du modèle

1 artefact

vae_celeba_latent_200_epochs_10_batch_64_subset_80000.pth

pth · 14,7 MB · SHA-256 3229ca548c16…593c · Hugging Face

Download file

Extraits de sources

2 extraits

--- library_name: pytorch tags: - vae - celeba - generative-model - latent-space - image-reconstruction - attribute-manipulation datasets: - celeba metrics: - reconstruction-loss - kl-divergence license: mit --- # Variational Autoencoder (VAE) - CelebA Dataset This repository contains a trained Variational Autoencoder (VAE) model on the CelebA dataset. The model is designed to encode and decode facial images, enabling tasks such as image reconstruction, latent space interpolation, and attribute manipulation. ## Model Details - **Architecture**: Variational Autoencoder (VAE) - **Dataset**: CelebA - **Latent Dimension**: 200 - **Training Subset Size**: 80,000 images - **Batch Size**: 64 - **Learning Rate**: 1e-3 - **Epochs**: 10 ### Weights and Biases Run The training process was tracked using [Weights and Biases](https://wandb.ai). You can view the full training logs and metrics [here](https://wandb.ai/hussam-alafandi/vae-celeba/runs/cv01woz1?nw=nwuserhussamalafandi). ## Usage ### Loading the Model To load the trained model, use the following code snippet: ```python import torch from vae_model import VAE # Ensure the VAE class is defined in vae_model.py # Define the latent dimension latent_dim = 200 # Initialize the model model = VAE(latent_dim=latent_dim) # Load the trained weights model_path = "./vae_celeba_latent_200_epochs_10_batch_64_subset_80000.pth" model.load_state_dict(torch.load(model_path)) model.eval() ``` ### Applications 1. **Image Reconstruction**: Reconstruct input images using the encoder and decoder. 2. **Latent Space Interpolation**: Generate smooth transitions between two images by interpolating in the latent space. 3. **Attribute Manipulation**: Modify specific attributes (e.g., smiling, hair color) by moving along attribute directions in the latent space. ## Example Results ### Reconstruction Below is a reconstruction example where the first row represents the original images, and the second row represents the reconstructed images: ![Reconstruction](./reconstruction_images_13_9c2c9b76dee391efede2.png) ### Latent Space Interpolation Below is an example of interpolating between two images in the latent space: ![Latent Space Interpolation](./latent_space_interpolation.png) ### Attribute Manipulation Manipulating the "Smiling" attribute in the latent space: ![Attribute Manipulation](./attribute_manipulation.p...

Source context: 0 downloads · 0 likes · Library pytorch · Repo hussamalafandi/VAE-CelebA