Skip to content

In this project we will train stable diffusion model on CIFAR10 dataset and then try to generate images form ten different classes.

Notifications You must be signed in to change notification settings

AHMEDSANA/Stable-Diffusion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Understanding Diffusion Models

Overview

Imagine a sculptor chipping away at a detailed statue, slowly turning a rough block into a masterpiece. Diffusion models work in reverse, starting with a blurry mess and gradually revealing high-quality data like images or text.

Adding Noise

Think of the messy block. The model starts with real data (like an image) and gradually adds noise, obscuring the details over many steps. This "forward process" creates a noisy version of the data.

Removing Noise

Now comes the sculpting. The model learns to reverse the noise addition, predicting tiny bits of detail at each step. This "reverse process" gradually removes the noise, unveiling the original data again.

Generating New Data

Once trained, the model can start with pure noise instead of real data. By running the reverse process, it sculpts that noise into brand new data that resembles the data it was trained on, like generating realistic images or composing coherent text.

Project Goal

Our goal is to apply stable diffusion models to the CIFAR-10 dataset, which contains images of various objects. By training a stable diffusion model on this dataset, we aim to generate high-quality images that capture the essence of each object category. This project enables us to explore the power of stable diffusion in creating life like images.

Running the Code

Prerequisites

To run the code, you will need:

  • Python installed on your machine
  • Jupyter Notebook or Google Colab for running the Python notebook
  • Internet connection for downloading required libraries and datasets

Steps

  1. Download the Notebook: Download the Python notebook file from the repository.

  2. Open in Jupyter Notebook or Google Colab: Open the downloaded notebook file using Jupyter Notebook on your local machine or upload it to Google Colab.

  3. Execute Cells: Run each cell in the notebook sequentially. This will install any required libraries and download the necessary dataset automatically.

  4. Follow Instructions: Follow the instructions provided within the notebook for running specific sections of code or performing tasks.

  5. Review Outputs: Once the code execution is complete, review the outputs and any generated files or visualizations.

  6. Customization (Optional): Optionally, you can customize the code or experiment with different parameters to explore further.

  7. Save Results (Optional): Save any modified versions of the notebook and the generated outputs for future reference.

Training Results (Five Epochs)

Overview

Below are the results obtained from training the model for five epochs. Due to resource constraints, the training was limited to five epochs only.

Loss Curves

  • Training Loss & Validation Loss:

Observations

  • The training loss decreased steadily over the five epochs, indicating that the model was learning from the data.
  • The validation loss also showed a decreasing trend, suggesting that the model's performance generalized well to unseen data.

Future Steps

  • Consider training the model for additional epochs to potentially improve performance further.
  • Explore techniques for optimizing resource usage to enable longer training sessions.
  • Fine-tune hyperparameters or experiment with different model architectures to enhance performance.

Note

  • These results are based on training the model for a limited number of epochs and may not represent the model's full potential.

  • Further experimentation and analysis are recommended to gain a comprehensive understanding of the model's capabilities.

Additional Notes

  • If using Google Colab, make sure to connect to a GPU runtime for faster processing, especially if working with large datasets or complex models.
  • Ensure that you have sufficient disk space available for downloading the required dataset.
  • Refer to the documentation or comments within the notebook for additional information on specific code sections or functions.