Skip to content

Latest commit

 

History

History
84 lines (68 loc) · 2.87 KB

README.md

File metadata and controls

84 lines (68 loc) · 2.87 KB

DCGAN-PyTorch

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

Table of Contents:

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:

  • To run the project, you need to add your configurations into the folder configs/. An example of the configurations that should be passed can be found here
  • sh run.sh
  • To run on a GPU, you need to enable cuda in the config file.

Results:

Loss:

alt text

Generated Images after training:

alt text

Requirements:

  • Pytorch: 0.4.0
  • torchvision: 0.2.1
  • tensorboardX: 1.2

Check requirements.txt.

References:

License:

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