Skip to content

Saloni0512/DCGAN_EXP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dcgan

A simple PyTorch implementation of DCGAN, a variant of Generative Adversial Networks on the FashionMNIST images.

Generated images after last epoch

The model is trained on 60,000 train-data images of the FashionMNIST dataset for 50 epochs on 2 T4 GPUs. Training images are 28x28 by default and they were resized to 32x32 for this experiment. Since the images have low resolution,the generator is updated twice every step during training.

Screenshot 2025-07-31 at 8 20 49 PM

Generator progression over all epochs

G progression gif

Real images and fake images

Screenshot 2025-07-31 at 8 21 31 PM The final generated images are not very high quality but show good diversity which means the generator has learned on a wide data distribution

Usage

  1. Run the following command to train the model and visualise results

    python3 main.py
    
  2. The results folder contains images generated for 15 epochs only as the on-device training was done on mps which takes up a lot of training time.

  3. Go to config.py file to change the number of epochs when training.

  4. The config.py file has support for cuda, mps and cpu.

  5. Checkout the detailed Kaggle Notebook for this project.

References

Key Takeaways

  1. Training GANs takes days.
  2. Hyperparameter tuning must be done according to the exact usecase and not through random trial and error methods.
  3. If discriminator becomes too strong, avoid adding dropouts in its architecture since overfitting might not be the issue here and this will most likely cause misleading results.
  4. Label smoothing gives sharper images - recommended for training on low resolution images.
  5. Training on 2 GPUs parallely saves a lot of training time!

✨Final note : Had an incredible amount of fun working on this experiment although its based on quite old research, i got a very good taste of computer vision and image generation in depth.

About

A simple PyTorch implementation of a DCGAN on fashion clothing and items

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages