Here I applied Deep Convolutional Generative Adversarial Networks (DCGANs) on the famous Celeba dataset using Pytorch. The reference and model for my project was taken from the paper, "Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks" by Alec Radford, Luke Metz and Soumith Chintala.
Link for the paper - https://arxiv.org/abs/1511.06434
Link for the data - https://www.kaggle.com/jessicali9530/celeba-dataset
The above pic is of the architecture of Generator. Discrimiator has the same layout but just opposite flow. The job of Generator is to take in random noise and turn it to something like real data while the job of Discriminator is to taken in data and give the probability of it being real.
For training our DCGAN, we took in 64643 real images from Celeba dataset and 64643 fake images from the generator and fed them to the discriminator. We used BCELoss or Binary Cross Entropy Loss as it's very similar to the loss mentioned in the paper and works just like it after doing some mods to the target. We used Adam as our optimizer for training with a learning rate of 2e-4. We also did some modification to the hyperparameters in accordance to the paper.
I trained for a total of 10 epocs on 60,000 images. Due to high computational cost, I was not able to train on all the images of Celeba dataset. The training took me around an hour and gave me okay resuls which are shown below.
As you can see above, I got okay results which can be improved by increasing the number of epochs and also by increasing the data size.
In the jupyter notebook, I have done a better explaination of the training process and in the Python file, I have only given my code so that anyone can use it in their project.
Feel free to contact me if you have any question regarding my project.