{"id":25857808,"url":"https://github.com/fareedkhan-dev/create-high-quality-dataset-for-computer-vision","last_synced_at":"2025-08-02T11:09:17.232Z","repository":{"id":209598133,"uuid":"724476040","full_name":"FareedKhan-dev/create-high-quality-dataset-for-computer-vision","owner":"FareedKhan-dev","description":"This project focuses on generating a diverse and realistic dataset for computer vision training using ChatGPT and a realistic vision image generation model. The process involves dynamically creating prompts, utilizing ChatGPT to generate image descriptions, and generating images based on those descriptions.","archived":false,"fork":false,"pushed_at":"2023-12-15T09:08:50.000Z","size":1359,"stargazers_count":10,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-12T05:41:03.756Z","etag":null,"topics":["chatgpt","computer-vision","cv","grounded-sam","stable-diffusion"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FareedKhan-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-11-28T06:40:04.000Z","updated_at":"2024-08-20T14:15:10.000Z","dependencies_parsed_at":"2025-06-12T05:42:19.982Z","dependency_job_id":null,"html_url":"https://github.com/FareedKhan-dev/create-high-quality-dataset-for-computer-vision","commit_stats":null,"previous_names":["fareedkhan-dev/create-high-quality-dataset-for-computer-vision"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/FareedKhan-dev/create-high-quality-dataset-for-computer-vision","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FareedKhan-dev%2Fcreate-high-quality-dataset-for-computer-vision","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FareedKhan-dev%2Fcreate-high-quality-dataset-for-computer-vision/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FareedKhan-dev%2Fcreate-high-quality-dataset-for-computer-vision/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FareedKhan-dev%2Fcreate-high-quality-dataset-for-computer-vision/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FareedKhan-dev","download_url":"https://codeload.github.com/FareedKhan-dev/create-high-quality-dataset-for-computer-vision/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FareedKhan-dev%2Fcreate-high-quality-dataset-for-computer-vision/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268378807,"owners_count":24240896,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chatgpt","computer-vision","cv","grounded-sam","stable-diffusion"],"created_at":"2025-03-01T19:17:55.342Z","updated_at":"2025-08-02T11:09:17.206Z","avatar_url":"https://github.com/FareedKhan-dev.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Computer Vision Project: Generating Realistic Datasets with Few Clicks\n\nComputer vision projects often require high-quality datasets to train robust models. In this blog post, we'll guide you through a simple process of generating a diverse and realistic dataset using a one-click approach. By leveraging the power of ChatGPT and a realistic vision image generation model, you can easily create a dataset tailored to your specific needs.\n\n## Step 1: Generating Realistic Image Prompts Using ChatGPT\n\nIn this initial step, we use the below ChatGPT free prompt to dynamically generate prompts for realistic-vision images. To tailor the prompts to your specific needs, you can adjust the parameters in the provided Python code.\n\n```python\n# Parameters\nimportant_objects = \"different kinds of bear\"  # If multiple, add them like this: different kinds of bear, pepsi bottles, ... etc\nnumber_of_prompts = 50  # Between 50 to 100 is recommended\ndescription_of_prompt = \"bear in different environments\"  # A brief description of the desired images\n\n# Generated Prompt\nprint(f'''\nImportant Objects that must be present in each prompt:\n{important_objects}\n\nInput:\nGenerate {number_of_prompts} realistic prompts related to {description_of_prompt} for image generation.\n\nInstructions:\nEach prompt depicts real-life behavior.\nEach prompt must contain all the important objects.\nThe important objects must be at different levels of distance (from very close to the camera to very far).\n\nOutput:\nReturn a Python list containing these prompts as strings for later use in training a computer vision model.\nprompts = [prompt1, prompt2, ...]\n''')\n```\nBy adjusting the parameters such as important_objects, number_of_prompts, and description_of_prompt, you can customize the prompts to suit the specific requirements of your computer vision project. The generated prompts will be crucial for obtaining a diverse and high-quality dataset for training your model.\n\n## Step 2: Utilizing ChatGPT to Generate Realistic Image Descriptions\n\nAfter creating the initial prompt template, the next step involves passing the generated prompt to ChatGPT for obtaining a Python list of strings containing the prompts. The output should be copied for further use.\n\n\u003cimg src=\"https://cdn-images-1.medium.com/max/1000/1*wyvPYwUMWxu8kLVILftu6A.png\" width=700\u003e\n\nReplace the example list with your custom prompts. In this instance, the focus is on detecting a specific animal, the bear.\n\n```python\n# Replace the following list with your own generated prompts\nprompts = [\n    \"A grizzly bear fishing in a river with a distant mountain in the background and a fish jumping out of the water.\",\n    \"A black bear climbing a tree to reach a beehive with a beehive in the foreground and a forest in the distance.\",\n    \"A polar bear standing on an iceberg in the Arctic Ocean with other icebergs in the background and a seal in the water.\",\n    # ... (more prompts)\n    \"A teddy bear reading a book on a cozy couch by a fireplace with a rug and bookshelf in the background.\"\n]\n\n# The total number of generated prompts\nlen(prompts)\n### Output is 50\n```\nReplace the prompts in the list with your specific requirements for the computer vision project. The diversity and specificity of these prompts play a crucial role in creating a high-quality and well-rounded dataset for training your computer vision model.\n\n## Step 3: Increasing the number of images from limited prompts\nIn this step, we increase the number of prompts to 100 by doubling the existing prompts list. The prompts are then shuffled to add variety to the generated images.\n\n```python\n# Update the code to generate 100 images from 50 prompts (you can choose your own)\nprompts = prompts * 2\n\n# Shuffle the prompts\nimport random\nrandom.shuffle(prompts)\n```\n\nThis adjustment allows for a more extensive set of prompts, providing diversity for the subsequent image generation process.\n\n## Step 4: Utilizing Realistic Vision Image Generation Model\n\nNow, we employ a realistic vision image generation model to generate images based on the shuffled prompts. You can use your own model if needed.\n\nPlease note the important instructions mentioned:\n1. Remove %%capture line if it throws any error.\n2. Ensure GPU is enabled for this task.\n\n```python\n# Install the required library\n%%capture\n!pip install diffusers\n\n# Import and load the realistic vision model\nfrom diffusers import DiffusionPipeline\npipeline = DiffusionPipeline.from_pretrained(\"SG161222/Realistic_Vision_V5.0_noVAE\")  # Loading the model\n\n# Convert the model to GPU\npipeline = pipeline.to(\"cuda\")\n\n# Generate images and save them in the \"generated_images\" directory\ngenerated_images = pipeline(prompts).images\n```\n\n## Step 5: Saving Generated Images\nFinally, we save the generated images in a directory named /generated_images/ within the current working directory.\n\n```python\n# Import necessary libraries\nimport os\n\n# Define the output directory name\noutput_directory = \"generated_images\"\n\n# Save each image in the directory\nfor i, image in enumerate(generated_images):\n    # Save the image with a unique filename\n    image.save(os.path.join(output_directory, f'image_{i + 1}.png'))\n```\n\nThis step ensures that the generated images are saved in the specified directory for later use in your computer vision project. Adjust the code as needed for your specific requirements.\n\nPrinting the sample of generated images\n\n\u003cimg src=\"https://cdn-images-1.medium.com/max/1500/1*Tz35NjmqMqorsU_SE10vmQ.png\"\u003e\n\n## Step 6: Installing Autodistill and Creating Ontology\nIn this step, we install the required libraries, including Autodistill, and create an ontology to define what you want to detect in the generated images.\n\n```python\n# Install the necessary libraries using pip\n!pip install -q autodistill autodistill-grounded-sam autodistill-yolov8 roboflow supervision==0.9.0\n\n# Import the required module for defining the ontology\nfrom autodistill.detection import CaptionOntology\n\n# Define the ontology (Specify what you want to detect in your generated images)\nontology = CaptionOntology({\n    \"Bear\": \"Bear\",\n})\n```\n\nThis step ensures that Autodistill and other related libraries are installed. Additionally, the ontology is created to provide a structured framework for auto-labeling the generated images based on the specified detection categories. Adjust the ontology categories according to your specific detection requirements.\n\n## Step 7: Running Grounded SAM Model for Auto-Detection and Labeling\nIn this step, we utilize the Grounded SAM model to automatically detect and label the specified objects in the generated images. Ensure that Autodistill and Autodistill Grounded SAM have been successfully installed.\n\n```python\n# Import the Grounded SAM model from Autodistill\nfrom autodistill_grounded_sam import GroundedSAM\n\n# Create an instance of the Grounded SAM model using the defined ontology\nbase_model = GroundedSAM(ontology=ontology)\n\n# Run the model to automatically detect and label objects in the generated images\ndataset = base_model.label(\n    input_folder='/content/generated_images',  # Specify the input folder containing the generated images\n    extension=\".png\",  # Specify the file extension of the images\n    output_folder='/content/output_folder'  # Specify the output folder for storing labeled data\n)\n```\nThis code snippet runs the Grounded SAM model on the generated images, automatically detecting and labeling the specified objects based on the ontology. Adjust the input and output folders as needed for your project. \nThe labeled dataset will be stored in the specified output folder for further use in your computer vision project. After executing the provided code, the output will consist of images with labels corresponding to the selected object of interest. in txt format. \n\nHere are sample of the generated results:\n\n\u003cimg src=\"https://cdn-images-1.medium.com/max/1500/1*obDvFQskmznn9u9uvdQJfA.png\"\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffareedkhan-dev%2Fcreate-high-quality-dataset-for-computer-vision","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffareedkhan-dev%2Fcreate-high-quality-dataset-for-computer-vision","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffareedkhan-dev%2Fcreate-high-quality-dataset-for-computer-vision/lists"}