Vignana-Jyothi / kp-gen-ai

MIT License
0 stars 0 forks source link

[Theory] GANS #16

Open head-iie-vnr opened 3 days ago

head-iie-vnr commented 3 days ago

We need to understand the backend architecture so that we can be confident about it.

-Model1: GAN We have generator & discriminator. Based on the user's choice it learns & improves upon.

It can be used for text2text, 2image, 2audio. We have multiple GANS, CGANS, CDGANs, fGANs.... a nd more

Long Tell

Market & Basket

Stable Diffusion : Works like Generative AI. based on prompt it can generate image.

VAE : Variational Autoencoder

pipeline is used

Exercise :

head-iie-vnr commented 3 days ago

NER

In the context of a Variational Autoencoder (VAE), the terms encoder, sampler, and decoder refer to different parts of the VAE architecture. Here's a detailed explanation of each component:

Encoder

The encoder is the part of the VAE that compresses the input data into a latent representation. It takes an input data point (e.g., an image) and maps it to a lower-dimensional latent space. In VAEs, the encoder typically outputs two things:

These two outputs parameterize a Gaussian distribution in the latent space.

Example: If the input is an image of size 28x28 pixels (like in the MNIST dataset), the encoder will map this image to a mean and a log variance vector of a specified latent dimension (e.g., 20).

Sampler

The sampler uses the mean and log variance output by the encoder to sample a point from the latent space. This process involves:

The reparameterization trick can be summarized as: [ z = \mu + \sigma \cdot \epsilon ] Where:

Decoder

The decoder is the part of the VAE that takes a point from the latent space and maps it back to the original data space. Essentially, it attempts to reconstruct the original input from its latent representation. The goal of the decoder is to produce data that is as close as possible to the original input data.

Example: If the latent space has a dimension of 20, the decoder will take a 20-dimensional vector and map it back to a 28x28 pixel image.

Misconception about the Sampler

It is not true that "the sampler will take data from the training dataset." The sampler does not directly interact with the training dataset. Instead, it samples points from the latent space based on the mean and log variance output by the encoder. The training dataset is only used by the encoder and decoder during the training process to learn how to compress and reconstruct the data.

Summary

output The diagram illustrates the process of a Variational Autoencoder (VAE):

  1. Encoder:

    • The input data is fed into the encoder.
    • The encoder compresses the input data into two outputs: the mean (μ) and the log variance (log σ²).
  2. Sampler:

    • The sampler uses the mean (μ) and log variance (log σ²) to sample a point from the latent space.
    • This is done using the reparameterization trick: ( z = \mu + \sigma \cdot \epsilon ), where (\epsilon) is random noise from a standard normal distribution.
  3. Decoder:

    • The sampled point ( z ) is fed into the decoder.
    • The decoder reconstructs the original data from the latent representation.

This process allows the VAE to generate new data samples similar to the input data, making it useful for various applications such as image generation, data augmentation, and anomaly detection.

head-iie-vnr commented 3 days ago

Generative Adversarial Networks (GANs) are a class of machine learning frameworks designed by Ian Goodfellow and his colleagues in 2014. They consist of two neural networks, the generator and the discriminator, which are trained simultaneously through adversarial processes.

  1. Generator: The generator network generates data that mimics the real data. It takes random noise as input and transforms it into data samples (e.g., images, text, etc.).

  2. Discriminator: The discriminator network evaluates the data produced by the generator. It tries to distinguish between real data (from the training set) and fake data (produced by the generator).

During training, the generator and discriminator engage in a two-player minimax game:

The objective of the GAN is to reach a point where the generator produces such realistic data that the discriminator can no longer distinguish between real and fake data with high accuracy.

Applications of GANs include:

GANs have opened up numerous possibilities in creative and technical fields, making them a significant advancement in the field of artificial intelligence and deep learning.

output (1)

The diagram explains the process of Generative Adversarial Networks (GANs):

  1. Generator:

    • The generator takes random noise (z) as input and generates fake data.
    • The goal of the generator is to produce data that is indistinguishable from real data.
  2. Fake Data:

    • The fake data generated by the generator is passed to the discriminator.
  3. Discriminator:

    • The discriminator takes both real data and fake data as input.
    • The goal of the discriminator is to classify the input data as real or fake.
  4. Real Data:

    • Real data from the training dataset is also fed into the discriminator for comparison.
  5. Output:

    • The discriminator outputs whether the input data is real or fake.

Training Process

Objective