{"id":15290471,"url":"https://github.com/andrewekhalel/edafa","last_synced_at":"2025-08-19T11:32:25.302Z","repository":{"id":42164029,"uuid":"153176983","full_name":"andrewekhalel/edafa","owner":"andrewekhalel","description":"Test Time Augmentation (TTA) wrapper for computer vision tasks: segmentation, classification, super-resolution, ... etc.","archived":false,"fork":false,"pushed_at":"2021-11-18T21:53:50.000Z","size":5464,"stargazers_count":123,"open_issues_count":1,"forks_count":21,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-12-15T11:19:15.879Z","etag":null,"topics":["augmentation","classification","computer-vision","keras","pytorch","segmentation","super-resolution","tensorflow","wrapper"],"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/andrewekhalel.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}},"created_at":"2018-10-15T20:25:55.000Z","updated_at":"2024-12-05T03:09:02.000Z","dependencies_parsed_at":"2022-08-29T22:51:05.238Z","dependency_job_id":null,"html_url":"https://github.com/andrewekhalel/edafa","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewekhalel%2Fedafa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewekhalel%2Fedafa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewekhalel%2Fedafa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewekhalel%2Fedafa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andrewekhalel","download_url":"https://codeload.github.com/andrewekhalel/edafa/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230351169,"owners_count":18212788,"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","classification","computer-vision","keras","pytorch","segmentation","super-resolution","tensorflow","wrapper"],"created_at":"2024-09-30T16:08:17.766Z","updated_at":"2024-12-18T23:07:21.441Z","avatar_url":"https://github.com/andrewekhalel.png","language":"Python","funding_links":["https://www.buymeacoffee.com/khalel"],"categories":[],"sub_categories":[],"readme":"\u003ca href=\"https://www.buymeacoffee.com/khalel\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png\" alt=\"Buy Me A Coffee\" style=\"height: 60px !important;width: 217px !important;\" \u003e\u003c/a\u003e\n\n# Edafa\n![GitHub](https://img.shields.io/github/license/mashape/apistatus.svg) [![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/andrewekhalel/edafa/issues) \u003cbr/\u003e\nEdafa is a simple wrapper that implements Test Time Augmentations (TTA) on images for computer vision problems like: segmentation, classification, super-resolution, Pansharpening, etc. TTAs guarantees better results in most of the tasks.\n\n### Test Time Augmentation (TTA)\n\nApplying different transformations to test images and then average for more robust results.\n\n![pipeline](https://preview.ibb.co/kH61v0/pipeline.png)\n\n### Installation\n```shell\npip install edafa\n```\n\n### Getting started\nThe easiest way to get up and running is to follow [example notebooks](https://github.com/andrewekhalel/edafa/tree/master/examples) for segmentation and classification showing TTA effect on performance.\n\n### How to use Edafa\nThe whole process can be done in 4 steps:\n1.  Import Predictor class based on your task category: Segmentation (`SegPredictor`) or Classification (`ClassPredictor`) \n```python\nfrom edafa import SegPredictor\n```\n2. Inherit Predictor class and implement the main function \n\t* `predict_patches(self,patches)` : where your model takes image patches (numpy.ndarray) and return prediction (numpy.ndarray)\n\n```python\nclass myPredictor(SegPredictor):\n    def __init__(self,model,*args,**kwargs):\n        super().__init__(*args,**kwargs)\n        self.model = model\n\n    def predict_patches(self,patches):\n        return self.model.predict(patches)\n```\n3. Create an instance of you class\n```python\np = myPredictor(model,patch_size,model_output_channels,conf_file_path)\n```\n4.  Call `predict_images()` to run the prediction process \n```python\np.predict_images(images,overlap=0)\n```\n### Configuration file\nConfiguration file is a json file containing two pieces of information\n1. Augmentations to apply (**augs**). Supported augmentations:\n\t* **NO** : No augmentation\n\t* **ROT90** : Rotate 90 degrees\n\t* **ROT180** : Rotate 180 degrees\n\t* **ROT270** : Rotate 270 degrees\n\t* **FLIP_UD** : Flip upside-down\n\t* **FLIP_LR** : Flip left-right\n\t* **BRIGHT** : Change image brightness randomly\n\t* **CONTRAST** : Change image contrast randomly\n\t* **GAUSSIAN** : Add random gaussian noise\n\t* **GAMMA** : Perform gamma correction with random gamma\n2. Combination of the results (**mean**). Supported mean types:\n\t* **ARITH** : Arithmetic mean\n\t* **GEO** : Geometric mean\n3. Number of bits image (default is 8-bits) (**bits**).\n\nExample of a conf file in `json` format\n```json\n{\n\"augs\":[\"NO\",\n\"FLIP_UD\",\n\"FLIP_LR\"],\n\"mean\":\"ARITH\",\n\"bits\":8\n}\n\n```\nExample of a conf file in `yaml` format\n```yaml\naugs: [NO,FLIP_UD,FLIP_LR]\nmean: ARITH\nbits: 8\n```\nYou can either pass file path (json or yaml) or the actual json text to `conf` parameter.\n\n## Contribution\nAll contributions are welcomed. Please make sure that all tests passed before pull request. To run tests\n```shell\nnosetests\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewekhalel%2Fedafa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrewekhalel%2Fedafa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewekhalel%2Fedafa/lists"}