imgaug.augmenters.flip

Augmenters that apply mirroring/flipping operations to images.

List of augmenters:

class imgaug.augmenters.flip.Fliplr(p=1, seed=None, name=None, random_state='deprecated', deterministic='deprecated')[source]

Bases: Augmenter

Flip/mirror input images horizontally.

Note

The default value for the probability is 0.0. So, to flip all input images use Fliplr(1.0) and not just Fliplr().

Supported dtypes:

See fliplr().

Parameters:
  • p (number or imgaug.parameters.StochasticParameter, optional) – Probability of each image to get flipped.

  • seed (None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional) – See __init__().

  • name (None or str, optional) – See __init__().

  • random_state (None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional) – Old name for parameter seed. Its usage will not yet cause a deprecation warning, but it is still recommended to use seed now. Outdated since 0.4.0.

  • deterministic (bool, optional) – Deprecated since 0.4.0. See method to_deterministic() for an alternative and for details about what the “deterministic mode” actually does.

Examples

>>> import imgaug.augmenters as iaa
>>> aug = iaa.Fliplr(0.5)

Flip 50 percent of all images horizontally.

>>> aug = iaa.Fliplr(1.0)

Flip all images horizontally.

Methods

__call__(*args, **kwargs)

Alias for augment().

augment([return_batch, hooks])

Augment a batch.

augment_batch(batch[, hooks])

Deprecated.

augment_batch_(batch[, parents, hooks])

Augment a single batch in-place.

augment_batches(batches[, hooks, background])

Augment multiple batches.

augment_bounding_boxes(bounding_boxes_on_images)

Augment a batch of bounding boxes.

augment_heatmaps(heatmaps[, parents, hooks])

Augment a batch of heatmaps.

augment_image(image[, hooks])

Augment a single image.

augment_images(images[, parents, hooks])

Augment a batch of images.

augment_keypoints(keypoints_on_images[, ...])

Augment a batch of keypoints/landmarks.

augment_line_strings(line_strings_on_images)

Augment a batch of line strings.

augment_polygons(polygons_on_images[, ...])

Augment a batch of polygons.

augment_segmentation_maps(segmaps[, ...])

Augment a batch of segmentation maps.

copy()

Create a shallow copy of this Augmenter instance.

copy_random_state(source[, recursive, ...])

Copy the RNGs from a source augmenter sequence.

copy_random_state_(source[, recursive, ...])

Copy the RNGs from a source augmenter sequence (in-place).

deepcopy()

Create a deep copy of this Augmenter instance.

draw_grid(images, rows, cols)

Augment images and draw the results as a single grid-like image.

find_augmenters(func[, parents, flat])

Find augmenters that match a condition.

find_augmenters_by_name(name[, regex, flat])

Find augmenter(s) by name.

find_augmenters_by_names(names[, regex, flat])

Find augmenter(s) by names.

get_all_children([flat])

Get all children of this augmenter as a list.

get_children_lists()

Get a list of lists of children of this augmenter.

get_parameters()

See get_parameters().

localize_random_state([recursive])

Assign augmenter-specific RNGs to this augmenter and its children.

localize_random_state_([recursive])

Assign augmenter-specific RNGs to this augmenter and its children.

pool([processes, maxtasksperchild, seed])

Create a pool used for multicore augmentation.

remove_augmenters(func[, copy, ...])

Remove this augmenter or children that match a condition.

remove_augmenters_(func[, parents])

Remove in-place children of this augmenter that match a condition.

remove_augmenters_inplace(func[, parents])

Deprecated.

reseed([random_state, deterministic_too])

Deprecated.

seed_([entropy, deterministic_too])

Seed this augmenter and all of its children.

show_grid(images, rows, cols)

Augment images and plot the results as a single grid-like image.

to_deterministic([n])

Convert this augmenter from a stochastic to a deterministic one.

get_parameters()[source]

See get_parameters().

class imgaug.augmenters.flip.Flipud(p=1, seed=None, name=None, random_state='deprecated', deterministic='deprecated')[source]

Bases: Augmenter

Flip/mirror input images vertically.

Note

The default value for the probability is 0.0. So, to flip all input images use Flipud(1.0) and not just Flipud().

Supported dtypes:

See flipud().

Parameters:
  • p (number or imgaug.parameters.StochasticParameter, optional) – Probability of each image to get flipped.

  • seed (None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional) – See __init__().

  • name (None or str, optional) – See __init__().

  • random_state (None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional) – Old name for parameter seed. Its usage will not yet cause a deprecation warning, but it is still recommended to use seed now. Outdated since 0.4.0.

  • deterministic (bool, optional) – Deprecated since 0.4.0. See method to_deterministic() for an alternative and for details about what the “deterministic mode” actually does.

Examples

>>> import imgaug.augmenters as iaa
>>> aug = iaa.Flipud(0.5)

Flip 50 percent of all images vertically.

>>> aug = iaa.Flipud(1.0)

Flip all images vertically.

Methods

__call__(*args, **kwargs)

Alias for augment().

augment([return_batch, hooks])

Augment a batch.

augment_batch(batch[, hooks])

Deprecated.

augment_batch_(batch[, parents, hooks])

Augment a single batch in-place.

augment_batches(batches[, hooks, background])

Augment multiple batches.

augment_bounding_boxes(bounding_boxes_on_images)

Augment a batch of bounding boxes.

augment_heatmaps(heatmaps[, parents, hooks])

Augment a batch of heatmaps.

augment_image(image[, hooks])

Augment a single image.

augment_images(images[, parents, hooks])

Augment a batch of images.

augment_keypoints(keypoints_on_images[, ...])

Augment a batch of keypoints/landmarks.

augment_line_strings(line_strings_on_images)

Augment a batch of line strings.

augment_polygons(polygons_on_images[, ...])

Augment a batch of polygons.

augment_segmentation_maps(segmaps[, ...])

Augment a batch of segmentation maps.

copy()

Create a shallow copy of this Augmenter instance.

copy_random_state(source[, recursive, ...])

Copy the RNGs from a source augmenter sequence.

copy_random_state_(source[, recursive, ...])

Copy the RNGs from a source augmenter sequence (in-place).

deepcopy()

Create a deep copy of this Augmenter instance.

draw_grid(images, rows, cols)

Augment images and draw the results as a single grid-like image.

find_augmenters(func[, parents, flat])

Find augmenters that match a condition.

find_augmenters_by_name(name[, regex, flat])

Find augmenter(s) by name.

find_augmenters_by_names(names[, regex, flat])

Find augmenter(s) by names.

get_all_children([flat])

Get all children of this augmenter as a list.

get_children_lists()

Get a list of lists of children of this augmenter.

get_parameters()

See get_parameters().

localize_random_state([recursive])

Assign augmenter-specific RNGs to this augmenter and its children.

localize_random_state_([recursive])

Assign augmenter-specific RNGs to this augmenter and its children.

pool([processes, maxtasksperchild, seed])

Create a pool used for multicore augmentation.

remove_augmenters(func[, copy, ...])

Remove this augmenter or children that match a condition.

remove_augmenters_(func[, parents])

Remove in-place children of this augmenter that match a condition.

remove_augmenters_inplace(func[, parents])

Deprecated.

reseed([random_state, deterministic_too])

Deprecated.

seed_([entropy, deterministic_too])

Seed this augmenter and all of its children.

show_grid(images, rows, cols)

Augment images and plot the results as a single grid-like image.

to_deterministic([n])

Convert this augmenter from a stochastic to a deterministic one.

get_parameters()[source]

See get_parameters().

imgaug.augmenters.flip.HorizontalFlip(*args, **kwargs)[source]

Alias for Fliplr.

imgaug.augmenters.flip.VerticalFlip(*args, **kwargs)[source]

Alias for Flipud.

imgaug.augmenters.flip.fliplr(arr)[source]

Flip an image-like array horizontally.

Supported dtypes:

  • uint8: yes; fully tested

  • uint16: yes; fully tested

  • uint32: yes; fully tested

  • uint64: yes; fully tested

  • int8: yes; fully tested

  • int16: yes; fully tested

  • int32: yes; fully tested

  • int64: yes; fully tested

  • float16: yes; fully tested

  • float32: yes; fully tested

  • float64: yes; fully tested

  • float128: yes; fully tested

  • bool: yes; fully tested

Parameters:

arr (ndarray) – A 2D/3D (H, W, [C]) image array.

Returns:

Horizontally flipped array.

Return type:

ndarray

Examples

>>> import numpy as np
>>> import imgaug.augmenters.flip as flip
>>> arr = np.arange(16).reshape((4, 4))
>>> arr_flipped = flip.fliplr(arr)

Create a 4x4 array and flip it horizontally.

imgaug.augmenters.flip.flipud(arr)[source]

Flip an image-like array vertically.

Supported dtypes:

  • uint8: yes; fully tested

  • uint16: yes; fully tested

  • uint32: yes; fully tested

  • uint64: yes; fully tested

  • int8: yes; fully tested

  • int16: yes; fully tested

  • int32: yes; fully tested

  • int64: yes; fully tested

  • float16: yes; fully tested

  • float32: yes; fully tested

  • float64: yes; fully tested

  • float128: yes; fully tested

  • bool: yes; fully tested

Parameters:

arr (ndarray) – A 2D/3D (H, W, [C]) image array.

Returns:

Vertically flipped array.

Return type:

ndarray

Examples

>>> import numpy as np
>>> import imgaug.augmenters.flip as flip
>>> arr = np.arange(16).reshape((4, 4))
>>> arr_flipped = flip.flipud(arr)

Create a 4x4 array and flip it vertically.