Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
I

imgaug

> 数据库
Open source

Image augmentation for machine learning experiments.

14.7K stars0 likes4 views
WebsiteGitHub

About

Image augmentation for machine learning experiments.

imgaug

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:

Table of Contents

  1. Features
  2. Installation
  3. Documentation
  4. Recent Changes
  5. Example Images
  6. Code Examples
  7. Citation

Features

  • Many augmentation techniques
    • E.g. affine transformations, perspective transformations, contrast changes, gaussian noise, dropout of regions, hue/saturation changes, cropping/padding, blurring, ...
    • Optimized for high performance
    • Easy to apply augmentations only to some images
    • Easy to apply augmentations in random order
  • Support for
    • Images (full support for uint8, for other dtypes see documentation)
    • Heatmaps (float32), Segmentation Maps (int), Masks (bool)
      • May be smaller/larger than their corresponding images. No extra lines of code needed for e.g. crop.
    • Keypoints/Landmarks (int/float coordinates)
    • Bounding Boxes (int/float coordinates)
    • Polygons (int/float coordinates)
    • Line Strings (int/float coordinates)
  • Automatic alignment of sampled random values
    • Example: Rotate image and segmentation map on it by the same value sampled from uniform(-10°, 45°). (0 extra lines of code.)
  • Probability distributions as parameters
    • Example: Rotate images by values sampled from uniform(-10°, 45°).
    • Example: Rotate images by values sampled from 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.
  • Many helper functions
    • Example: Draw heatmaps, segmentation maps, keypoints, bounding boxes, ...
    • Example: Scale segmentation maps, average/max pool of images/maps, pad images to aspect ratios (e.g. to square them)
    • Example: Convert keypoints to distance maps, extract pixels within bounding boxes from images, clip polygon to the image plane, ...
  • Support for augmentation on multiple CPU cores

Installation

The library supports python 2.7 and 3.4+.

Installation: Anaconda

To install the library in anaconda, perform the following commands:

bash
conda config --add channels conda-forge
conda install imgaug

You can deinstall the library again via conda remove imgaug.

Installation: pip

Then install imgaug either via pypi (can lag behind the github version):

bash
pip install imgaug

or install the latest version directly from github:

bash
pip install git+https://github.com/aleju/imgaug.git

For more details, see the install guide

To deinstall the library, just execute pip uninstall imgaug.

Documentation

Example jupyter notebooks:

  • Load and Augment an Image
  • Multicore Augmentation
  • Augment and work with: Keypoints/Landmarks, Bounding Boxes, Polygons, Line Strings, Heatmaps, Segmentation Maps

More notebooks: imgaug-doc/notebooks.

Example ReadTheDocs pages:

  • Quick example code on how to use the library
  • Overview of all Augmenters
  • API

More RTD documentation: imgaug.readthedocs.io.

All documentation related files of this project are hosted in the repository imgaug-doc.

Recent Changes

  • 0.4.0: Added new augmenters, changed backend to batchwise augmentation, support for numpy 1.18 and python 3.8.
  • 0.3.0: Reworked segmentation map augmentation, adapted to numpy 1.17+ random number sampling API, several new augmenters.
  • 0.2.9: Added polygon augmentation, added line string augmentation, simplified augmentation interface.
  • 0.2.8: Improved performance, dtype support and multicore augmentation.

See changelogs/ for more details.

Example Images

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,

Issues· 310 open

View all issuesOpen on GitHub
  • #871

    Security: CVE-2026-31235 / GHSA-g82g-j283-hj97 — unsafe pickle in BackgroundAugmenter (≤0.4.0)

    Updated Aug 21, 2026
  • #859

    AttributeError: np.sctypes was removed in NumPy 2.0 release

    Updated Sep 22, 2025
  • #405

    Feature Request: Color temperature

    Updated Mar 18, 2025
  • #858

    NP_****_TYPES error

    Updated Oct 26, 2024
  • #829

    numpy 1.20 bool deprecation

    Updated Oct 24, 2024
  • #855

    imgaug not compatible with numpy 2.0.1

    Updated Sep 10, 2024
  • #826

    Out Of Memory (OOM) error in perspective transformation

    Updated Jul 28, 2024
  • #842

    AttributeError: 'Delaunay' object has no attribute 'vertices'

    Updated Jul 19, 2024
  • #853

    AttributeError: module 'numpy' has no attribute 'complex'.

    Updated Jul 18, 2024
  • #788

    Segmentation Maps Border Treatment broken

    Updated Jul 2, 2024

> Tags

Pythonaffine-transformationaugment-imagesaugmentationbounding-boxes

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedOct 1, 2026
Category数据库
PricingOpen source

> Related tools

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库