/GANsNRoses_ODSC_Europe2022

GANs N' Roses: Understanding Generative Models

Primary LanguageJupyter NotebookMIT LicenseMIT

GANs N' Roses: Understanding Generative Models

Generative models are at the heart of DeepFakes, and can be used to synthesize, replace, or swap attributes of images. Learn the basics of Generative Adversarial Networks, the famous GANs, from the ground up: autoencoders, latent spaces, generators, discriminators, GANs, DCGANs, WGANs, and more.

The main goal of this sessions is to show you how GANs work: we will start with a simple example using synthetic data (not generated by GANs) to learn about latent spaces and how to use them to generate more synthetic data (using GANs to generate them). We will improve on the model's architecture, incorporating convolutional layers (DCGAN), different loss functions (WGAN, WGAN-GP) and use them to generate synthetic images of flowers (the roses!).

Intro: DeepFakes, GANs, and Synthetic data Learn about the different types of DeepFakes, and how GANs can be used to synthesize new data.

Module 1: Latent spaces and autoencoders Learn how autoencoders use latent spaces to represent data.

Module 2: Your first GAN Learn how decoders can be used as Generators, generating images from sampling latent spaces, and how to combine them with Discriminators to build your first GAN.

Module 3: Improving your GAN using Wasserstein distance (WGAN and WGAN-GP) Learn how to improve your GAN by changing its loss function and adding gradient penalty (GP).

Wrapping up: GANs N' Roses It's time to generate some synthetic roses!

We will use Google Colab and work our way together into building and training several GANs. You should be comfortable using Jupyter notebooks and Numpy, and training simple models in PyTorch.

Open it in Google Colab GANsNRoses.ipynb.

If you'd rather use a local environment, please follow these steps (assuming you use Anaconda):

  • Create a conda environment: conda create -n gansnroses pip conda python==3.8.5

  • Activate the conda environment: conda activate gansnroses

  • Install PyTorch LTS version: https://pytorch.org/get-started/locally/

  • Install other packages: conda install matplotlib==3.3.2 jupyter==1.0.0 scipy==1.5.2 pandas==1.1.3 -c anaconda

  • Clone this repo: git clone https://github.com/dvgodoy/GANsNRoses_ODSC_Europe2022.git

  • Start Jupyter: jupyter notebook