0% found this document useful (0 votes)
55 views6 pages

GenAI Assignment 3 & 4

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views6 pages

GenAI Assignment 3 & 4

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Assignment A3: Generative AI Model Implementation: GAN, Di usion Model

Due Date: 30/10/2024


Submission Format: Colab notebook le submission via the provided drive link

---

Objective:
In this assignment, you will implement two state-of-the-art generative AI models: a
Generative Adversarial Network (GAN) for image generation and a Di usion Model
for progressive image synthesis. This task will help you understand how generative
models work by learning the underlying data distribution and generating new
samples.

---

Assignment Details:

You are required to complete two tasks:

1. Task 1: Implement a Generative Adversarial Network (GAN)


- Implement a basic GAN to generate images using the MNIST or Fashion MNIST
dataset.
- The GAN will consist of two neural networks:
- A Generator, which learns to produce images that mimic the real dataset.
- A Discriminator, which tries to distinguish between real images and generated
(fake) images.

Requirements:
- Build both the generator and discriminator using fully connected or
convolutional layers.
- Train the GAN model for a reasonable number of epochs (e.g., 50 to 100),
ensuring the generator improves over time.
- Evaluate and visualize the performance:
- Plot the generated images at di erent stages of training to show the
progression of learning.
- Compare the generated images with real samples to assess the quality.

Expected Outputs:
- Generated images from the GAN at the end of training.
- Loss curves for both generator and discriminator during the training process.
- Explanation of any challenges encountered during training (e.g., mode collapse,
unstable training) and how you mitigated them.

---

2. Task 2: Implement a Di usion Model for Image Generation


ff
ff
fi
ff
ff
- Implement a basic Di usion Model to generate images using the MNIST or
Fashion MNIST dataset.
- A di usion model works by gradually adding noise to images and then learning
to reverse this process to generate new images.

Requirements:
- Start by de ning a noise schedule where noise is progressively added to real
images during training.
- Implement the reverse process where the model denoises noisy images to
generate new images from random noise.
- Train the di usion model on the dataset to generate new images from scratch.

Expected Outputs:
- Show the progression of generated images over time as the model gradually
denoises them.
- Visualize the noisy images during the forward process and compare them with
the denoised, generated images from the reverse process.
- Report and visualize any evaluation metrics used, such as Mean Squared Error
(MSE) or Inception Score (if applicable).

---

Implementation Guidelines:

1. Dataset:
- Use MNIST or Fashion MNIST dataset for both tasks. These datasets are
readily available through popular libraries like TensorFlow/Keras or PyTorch.

2. Frameworks:
- Use PyTorch for the implementation of both models.

3. Model Architecture:
- Ensure your models are well-structured and clearly explain the architecture of
the Generator and Discriminator (for GAN), and the noise schedule and denoising
process (for Di usion Model).
- The implementation should be modular, with separate functions or classes for
di erent components of the models.

4. Training and Evaluation:


- Train both models on the respective datasets. Provide a brief discussion of how
the models learn and generate images.
- Visualize and compare the generated outputs during di erent stages of training.

5. Colab Notebook:
- Your notebook should be well-commented and include sections that describe
the model architecture, training process, and results.
- Include visualizations like loss curves, sample outputs, and any evaluation
metrics used.
ff
ff
ff
fi
ff
ff
ff
---

Submission Instructions:
- Submit your Colab le through the provided Google Drive link.
- Ensure that the code in the notebook runs without errors, and all required outputs
(such as visualizations) are properly generated.
- Name your Colab notebook le as `USN_A3_Assignment.ipynb`.

---

Bonus Task (Optional):


For an additional challenge, try to:
- Improve the GAN’s performance by using techniques such as:
- Batch Normalization or Layer Normalization.
- Gradient Penalty or Wasserstein Loss to stabilize training.
- Implement a Deep Convolutional GAN (DCGAN) architecture.

- Explore a di erent di usion process: Implement a more advanced di usion


model like DDPM (Denoising Di usion Probabilistic Models) for better image
generation results.

—————————————————————————————————————
——————————————————————————

Assignment A4: Optimization Methods and Evaluation Metrics in Generative AI


Due Date: 30/10/2024
Submission Format: Hard copy written assignment

---

Objective:
This assignment aims to assess your understanding of various optimization
methods, evaluation metrics, and the challenges encountered in generative AI
models. You will explore the theory and practical implications of these techniques,
focusing on how they are used in training and evaluating models like GANs, VAEs,
and other generative models.

---

Assignment Tasks:

Part 1: Optimization Methods


You are required to write a detailed report on the following optimization methods
used in training machine learning models. For each optimization method, explain
ff
fi
ff
fi
ff
ff
its working mechanism, advantages, disadvantages, and when it is best suited for
use.

1. Gradient Descent:
- Explain the basic principle of gradient descent.
- Discuss its variants: Batch Gradient Descent and Mini-batch Gradient
Descent .
- Discuss its role in training machine learning models.

2. Stochastic Gradient Descent (SGD):


- Explain the di erences between SGD and standard gradient descent.
- Discuss the bene ts and drawbacks of using SGD.
- Describe the types of problems for which SGD is e ective.

3. Adam Optimizer (Adaptive Moment Estimation):


- Explain the workings of the Adam optimizer and how it improves on standard
gradient descent.
- Discuss the concepts of momentum and adaptive learning rates .
- Compare Adam with other optimizers in terms of performance and
convergence.

4. RMSProp (Root Mean Square Propagation):


- Describe the RMSProp algorithm and how it improves training in non-
stationary settings.
- Discuss the advantages of using RMSProp over SGD in certain tasks.

5. Adagrad (Adaptive Gradient Algorithm):


- Explain the Adagrad optimizer and how it adapts learning rates based on
historical gradients.
- Discuss its limitations and how it compares to other adaptive learning rate
methods.

6. AdaDelta:
- Explain the AdaDelta optimizer and how it modi es Adagrad to overcome its
limitations.
- Compare AdaDelta with other optimization algorithms, especially for deep
learning applications.

---

Part 2: Evaluation Metrics in Generative AI


For each of the following evaluation metrics, provide a detailed explanation of what
they measure, how they are calculated, and their signi cance in evaluating
generative models like GANs and VAEs.

1. Inception Score (IS):


- Explain how the Inception Score works.
- Discuss what it measures in terms of image quality and diversity.
ff
fi
fi
fi
ff
2. Frechet Inception Distance (FID):
- Describe the FID metric and how it compares real and generated images in
terms of distribution.
- Explain why FID is often preferred over the Inception Score.

3. Perplexity:
- Explain the Perplexity metric, commonly used in language models.
- Discuss its use in evaluating generative text models.

4. Reconstruction Error:
- De ne Reconstruction Error and its importance in evaluating autoencoders
and VAEs.
- Discuss the relationship between reconstruction error and model performance.

5. Mode Score:
- Describe the Mode Score and how it evaluates the quality and diversity of
generated samples.
- Compare the Mode Score with the Inception Score.

6. Diversity Metrics:
- Explain the importance of Diversity Metrics in evaluating generative models.
- Discuss speci c metrics used to assess diversity in generated data.

7. Wasserstein Distance / Earth Mover’s Distance (EMD):


- Describe the Wasserstein Distance (also known as Earth Mover’s Distance )
and its role in improving GAN training.
- Explain how EMD measures the di erence between real and generated data
distributions.

8. BLEU Score (Bilingual Evaluation Understudy):


- Explain the BLEU Score and its use in evaluating text generation models.
- Discuss its relevance to assessing generative models in natural language
processing.

---

Part 3: Challenges in Generative AI Training


Generative models, particularly GANs, face several key challenges during training.
Discuss the following challenges in detail, explaining their causes and how they
a ect the training process:

1. Mode Collapse:
- De ne Mode Collapse and explain how it occurs in generative models like
GANs.
- Discuss possible techniques for mitigating mode collapse.

2. Stability:
ff
fi
fi
fi
ff
- Discuss the issue of stability in training GANs and other generative models.
- Explain why maintaining stability is di cult in adversarial training and suggest
strategies to improve stability.

3. Convergence:
- Explain the concept of convergence in the context of generative models.
- Discuss why achieving convergence is challenging in GAN training and how
alternative loss functions (like Wasserstein loss) can help improve convergence.

---

ffi

You might also like