{"id":19196260,"url":"https://github.com/kupynorest/instance_augmentation","last_synced_at":"2025-08-03T04:35:50.130Z","repository":{"id":244083697,"uuid":"730686898","full_name":"KupynOrest/instance_augmentation","owner":"KupynOrest","description":"[ECCV 2024] Official Repo for: Dataset Enhancement with Instance-Level Augmentations","archived":false,"fork":false,"pushed_at":"2024-09-02T12:55:41.000Z","size":2583,"stargazers_count":44,"open_issues_count":7,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-20T10:40:33.785Z","etag":null,"topics":["augmentation","computer-vision","diffusion-models","eccv2024","image-generation","image-processing","machine-learning","pytorch"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KupynOrest.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-12-12T13:09:38.000Z","updated_at":"2025-04-01T20:12:03.000Z","dependencies_parsed_at":"2024-06-12T21:20:04.342Z","dependency_job_id":"a9f8f9b0-eaf8-4c7e-b2dc-150fd170dc0b","html_url":"https://github.com/KupynOrest/instance_augmentation","commit_stats":null,"previous_names":["kupynorest/instance_augmentation"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KupynOrest%2Finstance_augmentation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KupynOrest%2Finstance_augmentation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KupynOrest%2Finstance_augmentation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KupynOrest%2Finstance_augmentation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KupynOrest","download_url":"https://codeload.github.com/KupynOrest/instance_augmentation/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253171191,"owners_count":21865276,"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","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":["augmentation","computer-vision","diffusion-models","eccv2024","image-generation","image-processing","machine-learning","pytorch"],"created_at":"2024-11-09T12:13:11.198Z","updated_at":"2025-05-09T00:34:24.653Z","avatar_url":"https://github.com/KupynOrest.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# Dataset Enhancement with Instance-Level Augmentations\n\n[![Paper](https://img.shields.io/badge/arXiv-2406.08249-brightgreen)](https://arxiv.org/abs/2406.08249)\n[![Conference](https://img.shields.io/badge/ECCV-2024-blue)](https://eccv2024.ecva.net/)\n[![Project WebPage](https://img.shields.io/badge/Project-webpage-%23fc4d5d)](https://www.robots.ox.ac.uk/~vgg/research/instance-augmentation/)\n\n\u003c/div\u003e\n\nThis is an official repository for the paper\n```\nDataset Enhancement with Instance-Level Augmentations\nOrest Kupyn, Christian Rupprecht\nECCV 2024\n```\n\nInstance Augmentation method augment images by redrawing individual objects in the scene retaining their original shape. This allows training with the unchanged class label (e.g. class, segmentation, detection, etc.). The generations are highly diverse and match the scene composition\n\nOriginal             |  Augmented             |  Augmented\n:-------------------------:|:-------------------------:|:-------------------------:\n![](images/mp.jpeg)  |  ![](images/mp_1.png)  |  ![](images/mp_2.png)\n\n\n# Augmented Datasets\n\nThis repository contains links to several augmented datasets that can be used for various computer vision tasks, such as object detection, instance segmentation, and saliency detection.\n\n## Datasets\n\n1. **COCO Augmented Car**:\n   - Link: [https://thor.robots.ox.ac.uk/instance-augmentation/COCO_Augmented_Car.tar](https://thor.robots.ox.ac.uk/instance-augmentation/COCO_Augmented_Car.tar)\n   - Description: An anonymized version of the COCO dataset, focusing on the \"car\" class.\n\n2. **COCO Augmented People**:\n   - Link: [https://thor.robots.ox.ac.uk/instance-augmentation/COCO_Augmented_People.tar](https://thor.robots.ox.ac.uk/instance-augmentation/COCO_Augmented_People.tar)\n   - Description: An anonymized verison of the COCO dataset, focusing on the \"person\" class.\n\n3. **COCO Augmented**:\n   - Link: [https://thor.robots.ox.ac.uk/instance-augmentation/COCO_Augmented.tar](https://thor.robots.ox.ac.uk/instance-augmentation/COCO_Augmented.tar)\n   - Description: An augmented version of the entire COCO dataset.\n\n4. **DUTS Augmented**:\n   - Link: [https://thor.robots.ox.ac.uk/instance-augmentation/DUTS_Augmented.tar](https://thor.robots.ox.ac.uk/instance-augmentation/DUTS_Augmented.tar)\n   - Description: An augmented version of the DUTS dataset, which is commonly used for saliency detection.\n\n5. **DUTS SDXL (Experimental)**:\n   - Link: [https://thor.robots.ox.ac.uk/instance-augmentation/DUTS_SDXL.tar](https://thor.robots.ox.ac.uk/instance-augmentation/DUTS_SDXL.tar)\n   - Description: A larger, augmented version of the DUTS dataset.\n\n6. **SHA512 Checksums**:\n   - Link: [https://thor.robots.ox.ac.uk/instance-augmentation/SHA512SUMS](https://thor.robots.ox.ac.uk/instance-augmentation/SHA512SUMS)\n   - Description: A file containing the SHA512 checksums for the above augmented datasets, which can be used to verify the integrity of the downloaded files.\n\nPlease note that these augmented datasets are provided for research purposes. If you plan to use these datasets in your projects, make sure to follow the appropriate licensing and citation requirements.\n\n## Installation\n\nThe code uses **Python 3.8**.\n\n#### Create a Conda virtual environment and Install The Package:\n\nMake sure you have Conda installed.\n\n```bash\nmake env\n```\n\n#### Run Test for the Package:\n\n```bash\nmake pytest\n```\n\n#### Run on a folder of images:\n\nAn example is available in tests/test_pipeline.py - test_end_to_end\n\nTo predict instance masks:\n```python\nfrom instance_augmentation.pseudolabel_dataset import create_annotations\n\ncreate_annotations(\"path_to_image_folder\", \"path_to_save_results\", dataset_type=\"custom\", class_names=[\"dog\", \"cat\", \"any_other_classes\"])\n```\n\nTo generate augmented images:\n```python\nfrom instance_augmentation.pipeline.dataset_generator import DatasetGenerator\nfrom instance_augmentation.pipeline.readers import CustomDatasetReader\n\nreader = CustomDatasetReader(\"path_to_image_folder\", {}, \"path_to_save_results/annotations.json\")\ndataset_generator = DatasetGenerator.from_params(\n        dataset_reader=reader,\n        save_folder=\"path_to_save_results\",\n        preprocessing=\"resize\",\n        target_image_size=1024,\n        base_inpainting_model=\"SG161222/RealVisXL_V3.0\",\n        generator=\"inpaint_sdxl_adapter\",\n        num_samples=1,\n        num_inference_steps=20,\n        control_methods=[\"t2i_depth\", \"t2i_sketch\"],\n        control_weights=[0.9, 0.5],\n    )\n    dataset_generator.run()\n```\n\nTo apply augmentations:\n```python\nimport os\nimport cv2\nimport glob\nfrom instance_augmentation.augment import Augmenter\n\naugmenter = Augmenter(\"path_to_save_results\", p=1.0)\nfor image_path in glob.glob(\"path_to_image_folder/*\"):\n    image_name = os.path.split(image_path)[1]\n    original_image = cv2.cvtColor(cv2.imread(image_path), cv2.COLOR_BGR2RGB)\n    augmented_image = augmenter.augment_image(original_image, image_name)\n\n```\n\n## Citation\n\nIf you use the the method or this code - implicitly or explicitly - for your research projects, please cite the following paper:\n\n```\n@article{kupyn2024dataset,\n    title = {Dataset Enhancement with Instance-Level Augmentations},\n    author = {Kupyn, Orest and Rupprecht, Christian},\n    journal = {arXiv preprint arXiv:2406.08249},\n    year = {2024}\n  }\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkupynorest%2Finstance_augmentation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkupynorest%2Finstance_augmentation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkupynorest%2Finstance_augmentation/lists"}