10.8 C
New York
Monday, March 4, 2024

Quick Intro to GANs for People in a Hurry

Quick Intro to GANs for People in a Hurry

If someone says there’s no creativity in AI/ML and it’s all boring math, show them GANs! It’s one of the most interesting concepts in all of AI.

Generative Adversarial Networks (GANs) are a creative AI architecture, claimed by some to be the Generative AI breakthrough of the 2010s. They’re simple to understand yet extremely powerful.

In the next 3–5 minutes, you’ll have a crisp basic understanding of GANs.

  • GANs generate data.
  • 2 models compete with each other to analyze, capture and copy the variations in a dataset.
  • GANs get real data from the database and fake data from a model called a generator.
  • It creates fake data with feedback from the discriminator.
  • The fake data is similar to the real-world data.
  • Therefore, we get more training data with different permutations and combinations of input parameters with GANs.
  • The generator aims to make the discriminator classify the data generated by the generator as real.
  • The Generator Loss function penalizes the generator for failing to deceive the discriminator.
  • Backpropagation adjusts each weight according to the impact of input to improve the generator.
  • The discriminator identifies real data from the fake data (created by the generator).
  • The discriminator aims to identify real data from the fake data with the highest accuracy.
  • During discriminator training, the discriminator loss function penalizes for misclassifying real data as fake or vice versa.
  • GANs consist of 2 networks: Generator G(x) and Discriminator D(x).

G(x) and D(x) play a game. G(x) tries to fool the D(x) by generating real-like data while the D(x) tries to outsmart the G(x) by correctly classifying real and fake data.

  1. An input noise vector is fed to G(x), which creates fake data (initially of low quality normally).
  2. Real data from the database is passed to D(x) along with the fake data.
  3. D(x) labels the data as real or fake.
  4. D(x) and G(x) loss functions are calculated and backpropagated to D(x) and G(x) respectively.
  • Discriminator tries to get D(x) as 1 and G(z) as 0, meaning 100% accuracy,
  • Generator tries to get G(z) as 1, meaning the discriminator function considers all the fake images as real.
  1. Define the Problem
  2. Choose the architecture of GAN.
  3. Train the Discriminator on real world data
  4. Generate fake data for Generator
  5. Train Discriminator on fake data
  6. Train Generator with the output of Discriminator

Vanilla GANs:

  • Simplest type of GANs
  • Discriminator is a binary classifier and uses **sigmoid cross-entropy loss** for optimization.
  • G(x) and D(x) are simple multi-layer neural networks.

Deep Convolutional GANs (DCGANs):

  • Use convolutional neural networks instead of vanilla (simple) neural networks.
  • More stable and generate higher quality output.
  • Generator is a set of convolutional layers with transpose convolutions.
  • It upsamples (increases the quality/features) the input image at every convolutional layer.
  • Discriminator is a set of convolutional layers with strided convolutions.
  • It downsamples (decreases the quality/features) the input image at every convolutional layer.

Conditional GANs (CGANs):

  • An improvement upon Vanilla GANs.
  • Use extra labels to generate better performance.
  • In the generator, an additional parameter y is added.
  • Additional labels are fed to the discriminator to help distinguish real data from fake data.

Super Resolution GANs (SRGANs):

  • Use deep neural networks with adversarial neural networks to generate high-quality photo-realistic image when given a low resolution image
  1. Generating Cartoon Characters with DCGANs
  2. Generating Human Faces
  3. Text to Image Generation
  4. 3D Object Generation

Source link

Latest stories