Home

Awesome

DCGAN-PyTorch

A PyTorch implementation of Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks

Table of Contents:

<!-- Table of contents generated generated by http://tableofcontent.eu -->

Project Structure:

├── agents
|  └── dcgan.py # the main training agent for the dcgan
├── graphs
|  └── models
|  |  └── discriminator.py  # discriminator model definition
|  |  └── generator.py  # generator model definition
|  └── losses
|  |  └── loss.py # contains the binary cross entropy 
├── datasets  # contains all dataloaders for the project
|  └── celebA.py # dataloader for celebA dataset
├── data
|  └── celebA  # contains all celebA images
├── utils # utilities folder containing metrics , config parsing, etc
|  └── assets
├── main.py
├── run.sh

Data Preparation:

CelebA dataset has been used. All images are resized to 64x64. Data are placed into data/ folder.

Model:

alt text

This is the model we used in our implementation. However, the number of filters in our implementation goes from 512 -> 256 -> 128 -> 64. This can be tuned in the configurations file be editing the variables: num_filt_g and num_filt_d.

Experiment configs:

- Input size: 64x64x3
- Batch size: 64
- Learning rate: 0.0002
- Betas for Adam: 0.5 and 0.999
- Number of epochs: 30
- Noise vector size: 100
- Starting number of generator filters: 64
- Starting number of discriminator filters: 64

Usage:

Results:

Loss:

alt text

Generated Images after training:

alt text

Requirements:

Check requirements.txt.

References:

License:

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