{"id":16881456,"url":"https://github.com/swhl/image_augmentor","last_synced_at":"2026-05-19T03:12:50.772Z","repository":{"id":124970073,"uuid":"393638287","full_name":"SWHL/image_augmentor","owner":"SWHL","description":"An easy-to-use tool for offline data enhancement of images","archived":false,"fork":false,"pushed_at":"2021-11-29T13:08:08.000Z","size":8389,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-01-25T05:41:27.422Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SWHL.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}},"created_at":"2021-08-07T09:26:43.000Z","updated_at":"2021-11-29T13:08:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"ba664ae8-80e7-45ad-b765-5da47d5f77b5","html_url":"https://github.com/SWHL/image_augmentor","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/SWHL%2Fimage_augmentor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SWHL%2Fimage_augmentor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SWHL%2Fimage_augmentor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SWHL%2Fimage_augmentor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SWHL","download_url":"https://codeload.github.com/SWHL/image_augmentor/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244544744,"owners_count":20469719,"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":[],"created_at":"2024-10-13T16:02:36.911Z","updated_at":"2026-05-19T03:12:45.747Z","avatar_url":"https://github.com/SWHL.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Update\n### 2021-08-07 update\n- Add whl package for easy use\n\n## Note\n- **This code has a faster speed with the python-opencv.**\n- Modify from https://github.com/codebox/image_augmentor for image augmentation by python-opencv.\n\n## Image Augmentor\n\nThis is a simple data augmentation tool for image files, intended for use with machine learning data sets.\nThe tool scans a directory containing image files, and generates new images by performing a specified set of\naugmentation operations on each file that it finds. This process multiplies the number of training examples that can\nbe used when developing a neural network, and should significantly improve the resulting network's performance,\nparticularly when the number of training examples is relatively small.\n\nRun the utility from the command-line as follows:\n```python\nfrom img_aug_offline import ImgAugOffline\n\nimg_auger = ImgAugOffline()\nimg_auger(r'images', ['fliph', 'flipv'])\n```\nor\n```shell\npip install img_aug_offline-0.1-py3-none-any.whl\n\nimg_aug_offline images fliph flipv\n```\n\nThe `\u003cimage dir\u003e` argument should be the path to a directory containing the image files to be augmented.\nThe utility will search the directory recursively for files with any of the following extensions:\n`jpg, jpeg, bmp, png`.\n\nThe `transform` arguments determine what types of augmentation operations will be performed,\nusing the codes listed in the table below:\n\n|Code|Description|Example Values|\n|---|---|------|\n|`fliph`|Horizontal Flip|`fliph`|\n|`flipv`|Vertical Flip|`flipv`|\n|`noise`|Adds random noise to the image|`noise_20`,`noise_50`|\n|`rot`|Rotates the image by the specified amount|`rot_90`,`rot_-45`|\n|`trans`|Shifts the pixels of the image by the specified amounts in the x and y directions|`trans_20_10`,`trans_-10_0`|\n|`zoom`|Zooms into the specified region of the image, performing stretching/shrinking as necessary|`zoom_0_0_20_20`,`zoom_-10_-20_10_10`|\n|`blur`|Blurs the image by the specified amount, which is only odd number |`blur_1`,`blur_3`, `blur_5`|\n\n\nEach transform argument results in one additional output image being generated for each input image.\nAn argument may consist of one or more augmentation operations. Multiple operations within a single argument\nmust be separated by commas, and the order in which the operations are performed will match the order in which they\nare specified within the argument.\n\n### Examples\nProduce 2 output images for each input image, one of which is flipped horizontally, and one of which is flipped vertically:\n```shell\npython main.py ./images fliph flipv\n```\n\nProduce 1 output image for each input image, by first rotating the image by 90\u0026deg; and then flipping it horizontally:\n```shell\npython main.py ./images rot_90,fliph\n```\n\n### Operations\n\n#### Horizontal Flip\nMirrors the image around a vertical line running through its center\n```shell\npython main.py ./my_images fliph\n```\n\u003cimg src=\"./assets/Rabbit.jpg\" alt=\"Rabbit.jpg\" width=\"150\" height=\"150\" /\u003e\u0026nbsp;\u0026nbsp;\n\u003cimg src=\"./assets/flip/Rabbit_fliph.jpg\" alt=\"Rabbit_fliph.jpg\" width=\"150\" height=\"150\" /\u003e\n\n\n#### Vertical Flip\nMirrors the image around a horizontal line running through its center\n```shell\npython main.py ./my_images flipv\n```\n\u003cimg src=\"./assets/Rabbit.jpg\" alt=\"Rabbit.jpg\" width=\"150\" height=\"150\" /\u003e\u0026nbsp;\u0026nbsp;\n\u003cimg src=\"./assets/flip/Rabbit_flipv.jpg\" alt=\"Rabbit_flipv.jpg\" width=\"150\" height=\"150\" /\u003e\n\n\n#### Noise\nAdds random noise to the image. The amount of noise to be added is specified by a floating-point numeric value that is included\nin the transform argument, the numeric value must be greater than 0.\n```shell\npython main.py ./my_images noise_20 noise_50\n```\n\u003cimg src=\"./assets/Rabbit.jpg\" alt=\"Rabbit.jpg\" width=\"150\" height=\"150\" /\u003e\u0026nbsp;\u0026nbsp;\n\u003cimg src=\"./assets/noise/Rabbit_noise20.0.jpg\" alt=\"Rabbit_noise20.0.jpg\" width=\"150\" height=\"150\" /\u003e\u0026nbsp;\u0026nbsp;\n\u003cimg src=\"./assets/noise/Rabbit_noise50.0.jpg\" alt=\"Rabbit_noise50.0.jpg\" width=\"150\" height=\"150\" /\u003e\n\n\n#### Rotate\nRotates the image. The angle of rotation is specified by an integer value that is included in the transform argument.\n```shell\npython main.py ./my_images rot_-45 rot_90\n```\n\u003cimg src=\"./assets/Rabbit.jpg\" alt=\"Rabbit.jpg\" width=\"150\" height=\"150\" /\u003e\u0026nbsp;\u0026nbsp;\n\u003cimg src=\"./assets/rotate/Rabbit_rot-45.jpg\" alt=\"Rabbit_rot-45.jpg\" width=\"150\" height=\"150\" /\u003e\u0026nbsp;\u0026nbsp;\n\u003cimg src=\"./assets/rotate/Rabbit_rot90.jpg\" alt=\"Rabbit_rot90.jpg\" width=\"150\" height=\"150\" /\u003e\n\n\n#### Translate\nPerforms a translation on the image. The size of the translation in the x and y directions are specified by integer values that\nare included in the transform argument\n```shell\npython main.py ./my_images trans_20_20 trans_0_100\n```\n\u003cimg src=\"./assets/Rabbit.jpg\" alt=\"Rabbit.jpg\" width=\"150\" height=\"150\" /\u003e\u0026nbsp;\u0026nbsp;\n\u003cimg src=\"./assets/translate/Rabbit_trans20_20.jpg\" alt=\"Rabbit_trans20_20.jpg\" width=\"150\" height=\"150\" /\u003e\u0026nbsp;\u0026nbsp;\n\u003cimg src=\"./assets/translate/Rabbit_trans0_100.jpg\" alt=\"Rabbit_trans0_100.jpg\" width=\"150\" height=\"150\" /\u003e\n\n\n#### Zoom/Stretch\nZooms in (or out) to a particular area of the image. The top-left and bottom-right coordinates of the target region are\nspecified by integer values included in the transform argument. By specifying a target region with an aspect ratio that\ndiffers from that of the source image, stretching transformations can be performed.\n```shell\npython main.py ./my_images zoom_100_200_600_500 zoom_330_650_600_798\n```\n\u003cimg src=\"./assets/Rabbit.jpg\" alt=\"Rabbit.jpg\" width=\"150\" height=\"150\" /\u003e\u0026nbsp;\u0026nbsp;\n\u003cimg src=\"./assets/zoom/Rabbit_zoom100_200_600_500.jpg\" alt=\"Rabbit_zoom100_200_600_500.jpg\" width=\"150\" height=\"150\" /\u003e\u0026nbsp;\u0026nbsp;\n\u003cimg src=\"./assets/zoom/Rabbit_zoom330_650_600_798.jpg\" alt=\"Rabbit_zoom330_650_600_798.jpg\" width=\"150\" height=\"150\" /\u003e\n\n\n#### Blur\nBlurs the image by the `cv2.GaussianBlur()` of the opencv. The amount of blurring is specified by a  positive and odd value or zeros. Details in [GaussianBlur()](https://docs.opencv.org/master/d4/d86/group__imgproc__filter.html#gaabe8c836e97159a9193fb0b11ac52cf1). See `assets/blur/` for more examples.\n```shell\npython main.py ./my_images blur_1 blur_3 blur_9 blur_19\n```\n\u003cimg src=\"./assets/Rabbit.jpg\" alt=\"Rabbit.jpg\" width=\"150\" height=\"150\" /\u003e\u0026nbsp;\u0026nbsp;\n\u003cimg src=\"./assets/blur/blur_1.jpg\" alt=\"blur_1.jpg\" width=\"150\" height=\"150\" /\u003e\u0026nbsp;\u0026nbsp;\n\u003cimg src=\"./assets/blur/blur_3.jpg\" alt=\"blur_3.jpg\" width=\"150\" height=\"150\" /\u003e\u0026nbsp;\u0026nbsp;\n\u003cimg src=\"./assets/blur/blur_9.jpg\" alt=\"blur_9.jpg\" width=\"150\" height=\"150\" /\u003e\u0026nbsp;\u0026nbsp;\n\u003cimg src=\"./assets/blur/blur_19.jpg\" alt=\"blur_19.jpg\" width=\"150\" height=\"150\" /\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswhl%2Fimage_augmentor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswhl%2Fimage_augmentor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswhl%2Fimage_augmentor/lists"}