Image augmentation for machine learning experiments.
This python library helps you with augmenting images for your machine learning projects. It converts a set of input images into a new, much larger set of slightly altered images.
| Image | Heatmaps | Seg. Maps | Keypoints | Bounding Boxes, Polygons |
|
|---|---|---|---|---|---|
| Original Input | |||||
| Gauss. Noise + Contrast + Sharpen |
|||||
| Affine | |||||
| Crop + Pad |
|||||
| Fliplr + Perspective |
More (strong) example augmentations of one input image:
uniform(-10°, 45°). (0 extra lines of code.)uniform(-10°, 45°).ABS(N(0, 20.0))*(1+B(1.0, 1.0))", where ABS(.) is the absolute function, N(.) the gaussian distribution and B(.) the beta distribution.The library supports python 2.7 and 3.4+.
To install the library in anaconda, perform the following commands:
conda config --add channels conda-forge
conda install imgaugYou can deinstall the library again via conda remove imgaug.
Then install imgaug either via pypi (can lag behind the github version):
pip install imgaugor install the latest version directly from github:
pip install git+https://github.com/aleju/imgaug.gitFor more details, see the install guide
To deinstall the library, just execute pip uninstall imgaug.
Example jupyter notebooks:
More notebooks: imgaug-doc/notebooks.
Example ReadTheDocs pages:
More RTD documentation: imgaug.readthedocs.io.
All documentation related files of this project are hosted in the repository imgaug-doc.
See changelogs/ for more details.
The images below show examples for most augmentation techniques.
Values written in the form (a, b) denote a uniform distribution,
i.e. the value is randomly picked from the interval [a, b].
Line strings are supported by (almost) all augmenters, but are not explicitly
visualized here.
| meta | ||||
| Identity | ChannelShuffle | |||
| See also: Sequential, SomeOf, OneOf, Sometimes, WithChannels, Lambda, AssertLambda, AssertShape, RemoveCBAsByOutOfImageFraction, ClipCBAsToImagePlanes | ||||
| arithmetic | ||||
| Add | Add (per_channel=True) |
AdditiveGaussianNoise | AdditiveGaussianNoise (per_channel=True) |
Multiply |
| Cutout | Dropout | CoarseDropout (p=0.2) |
CoarseDropout (p=0.2, per_channel=True) |
Dropout2d |
| SaltAndPepper | CoarseSaltAndPepper (p=0.2) |
Invert | Solarize | JpegCompression |
| See also: AddElementwise, AdditiveLaplaceNoise, AdditivePoissonNoise, MultiplyElementwise, TotalDropout, ReplaceElementwise, ImpulseNoise, Salt, Pepper, CoarseSalt, |
Security: CVE-2026-31235 / GHSA-g82g-j283-hj97 — unsafe pickle in BackgroundAugmenter (≤0.4.0)
AttributeError: np.sctypes was removed in NumPy 2.0 release
Feature Request: Color temperature
NP_****_TYPES error
numpy 1.20 bool deprecation
imgaug not compatible with numpy 2.0.1
Out Of Memory (OOM) error in perspective transformation
AttributeError: 'Delaunay' object has no attribute 'vertices'
AttributeError: module 'numpy' has no attribute 'complex'.
Segmentation Maps Border Treatment broken