metadata
tags:
- dcgan
- generative-adversarial-network
- celeba
- image-generation
- deep-learning
datasets:
- CelebA
license: mit
DCGAN Model Card
Model Description
This is a Deep Convolutional Generative Adversarial Network (DCGAN) trained on the CelebA dataset to generate realistic 64x64 RGB images of human faces. The model was developed as part of the Generative AI course.
Training Details
- Dataset: CelebA
- Subset Size: 50,000 images
- Image Size: 64x64
- Number of Channels: 3 (RGB)
- Latent Dimension: 100
- Generator Feature Map Size: 64
- Discriminator Feature Map Size: 64
- Batch Size: 128
- Epochs: 50
- Learning Rate: 0.0002
- Beta1: 0.5
- Weight Decay: 0
- Optimizer: Adam
- Hardware: CUDA-enabled GPU
- Logging: Weights and Biases (wandb)
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 dcgan import Generator
# Load the configuration
config = {
"latent_dim": 100,
"ngf": 64,
"nc": 3
}
# Initialize the generator
generator = Generator(config)
# Load the trained weights
model_path = "./dcgan_celeba.pth"
generator.load_state_dict(torch.load(checkpoint_path, map_location=torch.device('cuda' if torch.cuda.is_available() else 'cpu')))
# Set the model to evaluation mode
generator.eval()
# Example: Generate an image
latent_vector = torch.randn(1, config["latent_dim"], 1, 1) # Batch size of 1
if torch.cuda.is_available():
latent_vector = latent_vector.cuda()
generator = generator.cuda()
generated_image = generator(latent_vector)
Example Results
Resources
- Course Repository: Generative AI Course
- WandB Run: DCGAN_CelebA Run
