imgaug.augmenters.flip¶
Augmenters that apply mirroring/flipping operations to images.
Do not import directly from this file, as the categorization is not final. Use instead
from imgaug import augmenters as iaa
and then e.g.
seq = iaa.Sequential([
iaa.Fliplr((0.0, 1.0)),
iaa.Flipud((0.0, 1.0))
])
List of augmenters:
- Fliplr
- Flipud
-
class
imgaug.augmenters.flip.
Fliplr
(p=0, name=None, deterministic=False, random_state=None)[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()
.dtype support:
See :func:`imgaug.augmenters.flip.fliplr`.
Parameters: - p (number or imgaug.parameters.StochasticParameter, optional) – Probability of each image to get flipped.
- name (None or str, optional) – See
imgaug.augmenters.meta.Augmenter.__init__()
. - deterministic (bool, optional) – See
imgaug.augmenters.meta.Augmenter.__init__()
. - random_state (None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.bit_generator.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional) – See
imgaug.augmenters.meta.Augmenter.__init__()
.
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 imgaug.augmenters.meta.Augmenter.augment()
.augment
(self[, return_batch, hooks])Augment a batch. augment_batch
(self, batch[, hooks])Augment a single batch. augment_batches
(self, batches[, hooks, …])Augment multiple batches. augment_bounding_boxes
(self, …[, hooks])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. 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_inplace
(self, func[, parents])Remove in-place children of this augmenter that match a condition. reseed
(self[, random_state, deterministic_too])Reseed 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
-
class
imgaug.augmenters.flip.
Flipud
(p=0, name=None, deterministic=False, random_state=None)[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()
.dtype support:
See :func:`imgaug.augmenters.flip.flipud`.
Parameters: - p (number or imgaug.parameters.StochasticParameter, optional) – Probability of each image to get flipped.
- name (None or str, optional) – See
imgaug.augmenters.meta.Augmenter.__init__()
. - deterministic (bool, optional) – See
imgaug.augmenters.meta.Augmenter.__init__()
. - random_state (None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.bit_generator.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional) – See
imgaug.augmenters.meta.Augmenter.__init__()
.
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 imgaug.augmenters.meta.Augmenter.augment()
.augment
(self[, return_batch, hooks])Augment a batch. augment_batch
(self, batch[, hooks])Augment a single batch. augment_batches
(self, batches[, hooks, …])Augment multiple batches. augment_bounding_boxes
(self, …[, hooks])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. 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_inplace
(self, func[, parents])Remove in-place children of this augmenter that match a condition. reseed
(self[, random_state, deterministic_too])Reseed 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
-
imgaug.augmenters.flip.
fliplr
(arr)[source]¶ Flip an image-like array horizontally.
dtype support:
* ``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.
dtype support:
* ``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.