# Jovian Commit Essentials
# Please retain and execute this cell without modifying the contents for `jovian.commit` to work
!pip install jovian --upgrade -q
import jovian
jovian.set_project('celebfaces-dcgan')
jovian.set_colab_id('1DcaCxgNFyxHc3zUgkkldXUR8UPXEMEBv')
Generative Modeling to generate bollywood celebrity faces
Hello! Through this Notebook I am trying to generate Bollywood celeb faces from an existing celeb faces dataset that I will download from Kaggle.
This is for the final project submission for the course "Deep Learning with PyTorch: Zero to GANs" from http://jovian.ai/
Deep neural networks are used mainly for supervised learning: classification or regression. Generative Adversarial Networks or GANs, however, use neural networks for a very different purpose: Generative modeling
Generative modeling is an unsupervised learning task in machine learning that involves given an input, model learns the probability distribution
of the variables making up this input and generate something new – either resembling the input or a new synthetic output
While there are many approaches used for generative modeling, a Generative Adversarial Network takes the following approach:
![alt](https://i.imgur.com/6NMdO9u.png)
There are two neural networks: a Generator and a Discriminator. The generator generates a "fake" sample given a random vector/matrix, and the discriminator attempts to detect whether a given sample is "real" (picked from the training data) or "fake" (generated by the generator). Training happens in tandem: we train the discriminator for a few epochs, then train the generator for a few epochs, and repeat. This way both the generator and the discriminator get better at doing their jobs.
GANs however, can be notoriously difficult to train, and are extremely sensitive to hyperparameters, activation functions and regularization. In this tutorial, we'll train a GAN to generate images of anime characters' faces.
We'll use the Bollywood Celeb faces Dataset, which consists of over 8664 cropped bollywood celeb faces. Note that generative modeling is an unsupervised learning task, so the images do not have to have any labels.
Most of the code in this tutorial is based on this notebook.
project_name = 'celebfaces-dcgan'
# Uncomment and run the appropriate command for your operating system, if required
# No installation is reqiured on Google Colab / Kaggle notebooks
# Linux / Binder / Windows (No GPU)
# !pip install numpy matplotlib torch==1.7.0+cpu torchvision==0.8.1+cpu torchaudio==0.7.0 -f https://download.pytorch.org/whl/torch_stable.html
# Linux / Windows (GPU)
# pip install numpy matplotlib torch==1.7.1+cu110 torchvision==0.8.2+cu110 torchaudio==0.7.2 -f https://download.pytorch.org/whl/torch_stable.html
# MacOS (NO GPU)
# !pip install numpy matplotlib torch torchvision torchaudio