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:
imgaug.augmenters.meta.Augmenter
Flip/mirror input images horizontally.
Note
The default value for the probability is
0.0
. So, to flip all input images useFliplr(1.0)
and not justFliplr()
.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__
(self, \*args, \*\*kwargs)Alias for augment()
.augment
(self[, return_batch, hooks])Augment a batch. augment_batch
(self, batch[, hooks])Deprecated. augment_batch_
(self, batch[, parents, hooks])Augment a single batch in-place. augment_batches
(self, batches[, hooks, …])Augment multiple batches. augment_bounding_boxes
(self, …[, parents, …])Augment a batch of bounding boxes. augment_heatmaps
(self, heatmaps[, parents, …])Augment a batch of heatmaps. augment_image
(self, image[, hooks])Augment a single image. augment_images
(self, images[, parents, hooks])Augment a batch of images. augment_keypoints
(self, keypoints_on_images)Augment a batch of keypoints/landmarks. augment_line_strings
(self, …[, parents, hooks])Augment a batch of line strings. augment_polygons
(self, polygons_on_images[, …])Augment a batch of polygons. augment_segmentation_maps
(self, segmaps[, …])Augment a batch of segmentation maps. copy
(self)Create a shallow copy of this Augmenter instance. copy_random_state
(self, source[, recursive, …])Copy the RNGs from a source augmenter sequence. copy_random_state_
(self, source[, …])Copy the RNGs from a source augmenter sequence (in-place). deepcopy
(self)Create a deep copy of this Augmenter instance. draw_grid
(self, images, rows, cols)Augment images and draw the results as a single grid-like image. find_augmenters
(self, func[, parents, flat])Find augmenters that match a condition. find_augmenters_by_name
(self, name[, regex, …])Find augmenter(s) by name. find_augmenters_by_names
(self, names[, …])Find augmenter(s) by names. get_all_children
(self[, flat])Get all children of this augmenter as a list. get_children_lists
(self)Get a list of lists of children of this augmenter. get_parameters
(self)See get_parameters()
.localize_random_state
(self[, recursive])Assign augmenter-specific RNGs to this augmenter and its children. localize_random_state_
(self[, recursive])Assign augmenter-specific RNGs to this augmenter and its children. pool
(self[, processes, maxtasksperchild, seed])Create a pool used for multicore augmentation. remove_augmenters
(self, func[, copy, …])Remove this augmenter or children that match a condition. remove_augmenters_
(self, func[, parents])Remove in-place children of this augmenter that match a condition. remove_augmenters_inplace
(self, func[, parents])Deprecated. reseed
(self[, random_state, deterministic_too])Deprecated. seed_
(self[, entropy, deterministic_too])Seed this augmenter and all of its children. show_grid
(self, images, rows, cols)Augment images and plot the results as a single grid-like image. to_deterministic
(self[, n])Convert this augmenter from a stochastic to a deterministic one. -
get_parameters
(self)[source]¶ See
get_parameters()
.
-
class
imgaug.augmenters.flip.
Flipud
(p=1, seed=None, name=None, random_state='deprecated', deterministic='deprecated')[source]¶ Bases:
imgaug.augmenters.meta.Augmenter
Flip/mirror input images vertically.
Note
The default value for the probability is
0.0
. So, to flip all input images useFlipud(1.0)
and not justFlipud()
.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__
(self, \*args, \*\*kwargs)Alias for augment()
.augment
(self[, return_batch, hooks])Augment a batch. augment_batch
(self, batch[, hooks])Deprecated. augment_batch_
(self, batch[, parents, hooks])Augment a single batch in-place. augment_batches
(self, batches[, hooks, …])Augment multiple batches. augment_bounding_boxes
(self, …[, parents, …])Augment a batch of bounding boxes. augment_heatmaps
(self, heatmaps[, parents, …])Augment a batch of heatmaps. augment_image
(self, image[, hooks])Augment a single image. augment_images
(self, images[, parents, hooks])Augment a batch of images. augment_keypoints
(self, keypoints_on_images)Augment a batch of keypoints/landmarks. augment_line_strings
(self, …[, parents, hooks])Augment a batch of line strings. augment_polygons
(self, polygons_on_images[, …])Augment a batch of polygons. augment_segmentation_maps
(self, segmaps[, …])Augment a batch of segmentation maps. copy
(self)Create a shallow copy of this Augmenter instance. copy_random_state
(self, source[, recursive, …])Copy the RNGs from a source augmenter sequence. copy_random_state_
(self, source[, …])Copy the RNGs from a source augmenter sequence (in-place). deepcopy
(self)Create a deep copy of this Augmenter instance. draw_grid
(self, images, rows, cols)Augment images and draw the results as a single grid-like image. find_augmenters
(self, func[, parents, flat])Find augmenters that match a condition. find_augmenters_by_name
(self, name[, regex, …])Find augmenter(s) by name. find_augmenters_by_names
(self, names[, …])Find augmenter(s) by names. get_all_children
(self[, flat])Get all children of this augmenter as a list. get_children_lists
(self)Get a list of lists of children of this augmenter. get_parameters
(self)See get_parameters()
.localize_random_state
(self[, recursive])Assign augmenter-specific RNGs to this augmenter and its children. localize_random_state_
(self[, recursive])Assign augmenter-specific RNGs to this augmenter and its children. pool
(self[, processes, maxtasksperchild, seed])Create a pool used for multicore augmentation. remove_augmenters
(self, func[, copy, …])Remove this augmenter or children that match a condition. remove_augmenters_
(self, func[, parents])Remove in-place children of this augmenter that match a condition. remove_augmenters_inplace
(self, func[, parents])Deprecated. reseed
(self[, random_state, deterministic_too])Deprecated. seed_
(self[, entropy, deterministic_too])Seed this augmenter and all of its children. show_grid
(self, images, rows, cols)Augment images and plot the results as a single grid-like image. to_deterministic
(self[, n])Convert this augmenter from a stochastic to a deterministic one. -
get_parameters
(self)[source]¶ See
get_parameters()
.
-
imgaug.augmenters.flip.
fliplr
(arr)[source]¶ Flip an image-like array horizontally.
Supported dtypes:
uint8
: yes; fully testeduint16
: yes; fully testeduint32
: yes; fully testeduint64
: yes; fully testedint8
: yes; fully testedint16
: yes; fully testedint32
: yes; fully testedint64
: yes; fully testedfloat16
: yes; fully testedfloat32
: yes; fully testedfloat64
: yes; fully testedfloat128
: yes; fully testedbool
: 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 testeduint16
: yes; fully testeduint32
: yes; fully testeduint64
: yes; fully testedint8
: yes; fully testedint16
: yes; fully testedint32
: yes; fully testedint64
: yes; fully testedfloat16
: yes; fully testedfloat32
: yes; fully testedfloat64
: yes; fully testedfloat128
: yes; fully testedbool
: 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.