{"id":31926968,"url":"https://github.com/mctigger/elaugment","last_synced_at":"2025-10-14T01:56:02.629Z","repository":{"id":57425965,"uuid":"205256305","full_name":"mctigger/elaugment","owner":"mctigger","description":"A lightweight data-augmentation library for machine learning","archived":false,"fork":false,"pushed_at":"2019-09-16T23:23:16.000Z","size":4589,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-14T01:55:59.003Z","etag":null,"topics":["affine","augmentation","color","contrast","crop","data-augmentation","deep-learning","deterministic","elastic","flip","image-augmentation","image-segmentation","machine-learning","python","random","reproducibility","resize","rotate"],"latest_commit_sha":null,"homepage":null,"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/mctigger.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":"2019-08-29T21:52:52.000Z","updated_at":"2020-01-09T02:16:25.000Z","dependencies_parsed_at":"2022-09-19T06:00:19.394Z","dependency_job_id":null,"html_url":"https://github.com/mctigger/elaugment","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mctigger/elaugment","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mctigger%2Felaugment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mctigger%2Felaugment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mctigger%2Felaugment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mctigger%2Felaugment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mctigger","download_url":"https://codeload.github.com/mctigger/elaugment/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mctigger%2Felaugment/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279017476,"owners_count":26086090,"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-10-13T02:00:06.723Z","response_time":61,"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":["affine","augmentation","color","contrast","crop","data-augmentation","deep-learning","deterministic","elastic","flip","image-augmentation","image-segmentation","machine-learning","python","random","reproducibility","resize","rotate"],"created_at":"2025-10-14T01:55:54.594Z","updated_at":"2025-10-14T01:56:02.622Z","avatar_url":"https://github.com/mctigger.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# elaugment\nelaugment is a Python package for reproducible data-augmentation. In difference to most other libraries random parameters for transformations are drawn seperate from the transformations. This makes it very easy apply the same transformations to several images. An example where this behaviour is useful is semantic segmentation, when you need to modify the input and the mask in the same way.\n\nThis library is currently in it's early stages so interfaces may break and some operations are slow. \n\n## Installation\n- Clone this repository\n- or run \n``` pip install elaugment ```\n\n## Usage\n\nelaugment essentially only provides two types classes: `Random` and `Transformation`. A objects of type `Random` must implement the `draw(rs)` method that generates a randomized transformation given a numpy random state. Then this transformation is returned as an instance of a `Transformation`-subclass. The numpy random state is necessary to draw random parameters from a fixed random seed. Here is a simple example:\n\n```python\nimport numpy as np\nfrom elaugment.image.random import RandomCrop\n\nrs = np.random.RandomState(seed=0)\n\nrt = RandomCrop(224) # rt is of type Random\nt1 = rt.draw(rs) # t1 is of type Transformation\nt2 = rt.draw(rs) # t2 is of type Transformation\n\n# a == b --\u003e True\na = t1(original_image)\nb = t1(original_image) \n\n# c == a --\u003e False\nc = t2(original_image)\n\n```\n\nA transformation is always deterministic, which means it can applied multiple times but will always apply the same transformation to the input. Any new call to a random-object, however, will return a different transformation each time.\n\n## Examples\nSee `/examples` for an comprehensive overview. Or if github does not render the notebooks click [here](https://nbviewer.jupyter.org/github/Mctigger/elaugment/blob/master/examples/transformations.ipynb). \n\nHere is a list of some transformations that are current implemented:\n\n```python\ntransforms = {\n    'Identity': Identity(),\n    'FlipLr': transformations.FlipLr(),\n    'FlipUd': transformations.FlipUd(),\n    'Affine - rotation 30°': transformations.Affine(img.shape[0], rotation=30),\n    'Affine - scale (3, 1,5)': transformations.Affine(img.shape[0], scale=(3, 1.5)),\n    'Affine - translation (30, -30)': transformations.Affine(img.shape[0], translation=(30, -30)),\n    'Affine - shear 30': transformations.Affine(img.shape[0], shear=30),\n    'Affine - everything': transformations.Affine(\n        img.shape[0], \n        shear=30, \n        rotation=30,\n        scale=(2, 1.5),\n        translation=(30, -30)\n    ),\n    'CropAbsolute': transformations.CropAbsolute(256, 256, 128, 128),\n    'CropRelaugmenttive': transformations.CropRelaugmenttive(0.5, 0.5, 0.25, 0.25),\n    'CropByFloat': transformations.CropByFloat(256, 256, top=0.25, left= 0.25),\n    'CenterCrop': transformations.CenterCrop(crop_size=256),\n    'TopLeftCrop': transformations.TopLeftCrop(crop_size=256),\n    'TopRightCrop': transformations.TopRightCrop(crop_size=256),\n    'BottomLeftCrop': transformations.BottomLeftCrop(crop_size=256),\n    'BottomRightCrop': transformations.BottomRightCrop(crop_size=256),\n    'Resize': transformations.Resize((256, 256), mode='reflect'),\n    'Rotate90 - k=1': transformations.Rotate90(k=1),\n    'Rotate90 - k=2': transformations.Rotate90(k=2),\n    'ColorAdjustment': transformations.ColorAdjustment(hue_shift=0.5, sat_shift=0.8, val_shift=0.9),\n    'ColorPertubation': transformations.ColorPerturbation(alphas=[0.2, 0.2, 0.2]),\n    'RandomDistortion': random.RandomDistortion(5, 5, 0.1, 0.1).draw(rs),\n}\n```\n\n## Contribute\nTransformations are easy to integrate into elaugment, so just create pull-requests when you feel like it!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmctigger%2Felaugment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmctigger%2Felaugment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmctigger%2Felaugment/lists"}