A simple PyTorch implementation of DCGAN, a variant of Generative Adversial Networks on the FashionMNIST images.
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.
The final generated images are not very high quality but show good diversity which means the generator has learned on a wide data distribution
-
Run the following command to train the model and visualise results
python3 main.py -
The
resultsfolder contains images generated for 15 epochs only as the on-device training was done onmpswhich takes up a lot of training time. -
Go to
config.pyfile to change the number of epochs when training. -
The
config.pyfile has support for cuda, mps and cpu. -
Checkout the detailed Kaggle Notebook for this project.
- Training GANs takes days.
- Hyperparameter tuning must be done according to the exact usecase and not through random trial and error methods.
- 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.
- Label smoothing gives sharper images - recommended for training on low resolution images.
- 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.

