This repository contains code for generating a synthetic Indian road dataset using diffusion models. The project involves creating photorealistic images of Indian roads with potholes, crowds, and cars using a diffusion-based generative model. The generated dataset can be used for various computer vision tasks, such as object detection and segmentation.
The main challenge of this project was to create a synthetic dataset that accurately represents Indian roads. This involved generating images with realistic road conditions, including potholes, diverse crowds, and different types of vehicles.
The project is implemented using Python and PyTorch. Here's an overview of the key components of the code:
- Diffusion Model Setup: The code sets up a diffusion model using the
diffusers
library and loads a pre-trained model for image generation. - Indian Roads Dataset: The Indian roads dataset is downloaded using the
opendatasets
library. The dataset contains diverse images of Indian roads. - Data Preprocessing: The dataset is preprocessed and transformed into appropriate formats for training the generative model.
- Generator and Discriminator Networks: The generator and discriminator networks are defined using convolutional neural networks (CNNs) in PyTorch. These networks are trained adversarially to generate realistic road images.
- Training Loop: The training loop consists of training the discriminator and generator networks iteratively to improve the quality of generated images.
- Image Generation: The trained generator is used to generate synthetic Indian road images, which are saved for evaluation and use.
-
Clone the Repository: git clone https://github.com/username/synthetic-indian-road-dataset.git cd synthetic-indian-road-dataset
-
Install Dependencies: Use the provided google collab jupyter notebooks to install dependencies
-
Download the Pre-trained Model: Download the pre-trained diffusion model from the Hugging Face model hub and place it in the project directory.
-
Download and Preprocess Dataset: Run the notebook or script to download the Indian roads dataset, preprocess the images, and create the data loaders.
-
Training: Train the generator and discriminator networks using the provided training loop. Adjust hyperparameters as needed.
-
Generate Images: Use the trained generator to generate synthetic Indian road images by providing appropriate prompts.
Below are some generated images showcasing the diversity and realism achieved by the generative model:

- Thanks to the diffusers library for providing the stable diffusion model.
- The Indian roads dataset used in this project is sourced from Kaggle.
This project is licensed under the MIT License - see the LICENSE file for details.
Feel free to contribute, report issues, and use the generated dataset for research and development purposes. Happy coding! 🚀