imgaug.augmenters.weather¶
Augmenters that create weather effects.
List of augmenters:
-
class
imgaug.augmenters.weather.
CloudLayer
(intensity_mean, intensity_freq_exponent, intensity_coarse_scale, alpha_min, alpha_multiplier, alpha_size_px_max, alpha_freq_exponent, sparsity, density_multiplier, seed=None, name=None, random_state='deprecated', deterministic='deprecated')[source]¶ Bases:
imgaug.augmenters.meta.Augmenter
Add a single layer of clouds to an image.
Supported dtypes:
uint8
: yes; indirectly tested (1)uint16
: nouint32
: nouint64
: noint8
: noint16
: noint32
: noint64
: nofloat16
: yes; not testedfloat32
: yes; not testedfloat64
: yes; not testedfloat128
: yes; not tested (2)bool
: no
- Indirectly tested via tests for
Clouds`
andFog
- Indirectly tested via tests for
- Note that random values are usually sampled as
int64
orfloat64
, whichfloat128
images would exceed. Note also that random values might have to upscaled, which is done viaimresize_many_images()
and has its own limited dtype support (includes however floats up to64bit
).
- Note that random values are usually sampled as
Parameters: intensity_mean (number or tuple of number or list of number or imgaug.parameters.StochasticParameter) – Mean intensity of the clouds (i.e. mean color). Recommended to be in the interval
[190, 255]
.- If a
number
, then that value will always be used. - If a
tuple
(a, b)
, then a value will be uniformly sampled per image from the interval[a, b]
. - If a
list
, then a random value will be sampled from thatlist
per image. - If a
StochasticParameter
, then a value will be sampled per image from that parameter.
- If a
intensity_freq_exponent (number or tuple of number or list of number or imgaug.parameters.StochasticParameter) – Exponent of the frequency noise used to add fine intensity to the mean intensity. Recommended to be in the interval
[-2.5, -1.5]
. See__init__()
for details.intensity_coarse_scale (number or tuple of number or list of number or imgaug.parameters.StochasticParameter) – Standard deviation of the gaussian distribution used to add more localized intensity to the mean intensity. Sampled in low resolution space, i.e. affects final intensity on a coarse level. Recommended to be in the interval
(0, 10]
.- If a
number
, then that value will always be used. - If a
tuple
(a, b)
, then a value will be uniformly sampled per image from the interval[a, b]
. - If a
list
, then a random value will be sampled from thatlist
per image. - If a
StochasticParameter
, then a value will be sampled per image from that parameter.
- If a
alpha_min (number or tuple of number or list of number or imgaug.parameters.StochasticParameter) – Minimum alpha when blending cloud noise with the image. High values will lead to clouds being “everywhere”. Recommended to usually be at around
0.0
for clouds and>0
for fog.- If a
number
, then that value will always be used. - If a
tuple
(a, b)
, then a value will be uniformly sampled per image from the interval[a, b]
. - If a
list
, then a random value will be sampled from thatlist
per image. - If a
StochasticParameter
, then a value will be sampled per image from that parameter.
- If a
alpha_multiplier (number or tuple of number or list of number or imgaug.parameters.StochasticParameter) – Multiplier for the sampled alpha values. High values will lead to denser clouds wherever they are visible. Recommended to be in the interval
[0.3, 1.0]
. Note that this parameter currently overlaps with density_multiplier, which is applied a bit later to the alpha mask.- If a
number
, then that value will always be used. - If a
tuple
(a, b)
, then a value will be uniformly sampled per image from the interval[a, b]
. - If a
list
, then a random value will be sampled from thatlist
per image. - If a
StochasticParameter
, then a value will be sampled per image from that parameter.
- If a
alpha_size_px_max (number or tuple of number or list of number or imgaug.parameters.StochasticParameter) – Controls the image size at which the alpha mask is sampled. Lower values will lead to coarser alpha masks and hence larger clouds (and empty areas). See
__init__()
for details.alpha_freq_exponent (number or tuple of number or list of number or imgaug.parameters.StochasticParameter) – Exponent of the frequency noise used to sample the alpha mask. Similarly to alpha_size_max_px, lower values will lead to coarser alpha patterns. Recommended to be in the interval
[-4.0, -1.5]
. See__init__()
for details.sparsity (number or tuple of number or list of number or imgaug.parameters.StochasticParameter) – Exponent applied late to the alpha mask. Lower values will lead to coarser cloud patterns, higher values to finer patterns. Recommended to be somewhere around
1.0
. Do not deviate far from that value, otherwise the alpha mask might get weird patterns with sudden fall-offs to zero that look very unnatural.- If a
number
, then that value will always be used. - If a
tuple
(a, b)
, then a value will be uniformly sampled per image from the interval[a, b]
. - If a
list
, then a random value will be sampled from thatlist
per image. - If a
StochasticParameter
, then a value will be sampled per image from that parameter.
- If a
density_multiplier (number or tuple of number or list of number or imgaug.parameters.StochasticParameter) – Late multiplier for the alpha mask, similar to alpha_multiplier. Set this higher to get “denser” clouds wherever they are visible. Recommended to be around
[0.5, 1.5]
.- If a
number
, then that value will always be used. - If a
tuple
(a, b)
, then a value will be uniformly sampled per image from the interval[a, b]
. - If a
list
, then a random value will be sampled from thatlist
per image. - If a
StochasticParameter
, then a value will be sampled per image from that parameter.
- If a
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.
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. draw_on_image generate_maps -
get_parameters
(self)[source]¶ See
get_parameters()
.
-
class
imgaug.augmenters.weather.
Clouds
(seed=None, name=None, random_state='deprecated', deterministic='deprecated')[source]¶ Bases:
imgaug.augmenters.meta.SomeOf
Add clouds to images.
This is a wrapper around
CloudLayer
. It executes 1 to 2 layers per image, leading to varying densities and frequency patterns of clouds.This augmenter seems to be fairly robust w.r.t. the image size. Tested with
96x128
,192x256
and960x1280
.Supported dtypes:
uint8
: yes; testeduint16
: no (1)uint32
: no (1)uint64
: no (1)int8
: no (1)int16
: no (1)int32
: no (1)int64
: no (1)float16
: no (1)float32
: no (1)float64
: no (1)float128
: no (1)bool
: no (1)
- Parameters of this augmenter are optimized for the value range
of
uint8
. While other dtypes may be accepted, they will lead to images augmented in ways inappropriate for the respective dtype.
- Parameters of this augmenter are optimized for the value range
of
Parameters: - 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.Clouds()
Create an augmenter that adds clouds to images.
Methods
__call__
(self, *args, **kwargs)Alias for augment()
.add
(self, augmenter)Add an augmenter to the list of child augmenters. append
(self, object, /)Append object to the end of the list. 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. clear
(self, /)Remove all items from list. 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). count
(self, value, /)Return number of occurrences of value. 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. extend
(self, iterable, /)Extend list by appending elements from the iterable. 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)See get_children_lists()
.get_parameters
(self)See get_parameters()
.index
(self, value[, start, stop])Return first index of value. insert
(self, index, object, /)Insert object before index. 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. pop
(self[, index])Remove and return item at index (default last). remove
(self, value, /)Remove first occurrence of value. 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. reverse
(self, /)Reverse IN PLACE. 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. sort
(self, /, *[, key, reverse])Stable sort IN PLACE. to_deterministic
(self[, n])Convert this augmenter from a stochastic to a deterministic one.
-
class
imgaug.augmenters.weather.
FastSnowyLandscape
(lightness_threshold=(100, 255), lightness_multiplier=(1.0, 4.0), from_colorspace='RGB', seed=None, name=None, random_state='deprecated', deterministic='deprecated')[source]¶ Bases:
imgaug.augmenters.meta.Augmenter
Convert non-snowy landscapes to snowy ones.
This augmenter expects to get an image that roughly shows a landscape.
This augmenter is based on the method proposed in https://medium.freecodecamp.org/image-augmentation-make-it-rain-make-it-snow-how-to-modify-a-photo-with-machine-learning-163c0cb3843f?gi=bca4a13e634c
Supported dtypes:
uint8
: yes; fully testeduint16
: no (1)uint32
: no (1)uint64
: no (1)int8
: no (1)int16
: no (1)int32
: no (1)int64
: no (1)float16
: no (1)float32
: no (1)float64
: no (1)float128
: no (1)bool
: no (1)
- This augmenter is based on a colorspace conversion to HLS.
Hence, only RGB
uint8
inputs are sensible.
- This augmenter is based on a colorspace conversion to HLS.
Hence, only RGB
Parameters: lightness_threshold (number or tuple of number or list of number or imgaug.parameters.StochasticParameter, optional) – All pixels with lightness in HLS colorspace that is below this value will have their lightness increased by lightness_multiplier.
- If a
number
, then that value will always be used. - If a
tuple
(a, b)
, then a value will be uniformly sampled per image from the discrete interval[a..b]
. - If a
list
, then a random value will be sampled from thatlist
per image. - If a
StochasticParameter
, then a value will be sampled per image from that parameter.
- If a
lightness_multiplier (number or tuple of number or list of number or imgaug.parameters.StochasticParameter, optional) – Multiplier for pixel’s lightness value in HLS colorspace. Affects all pixels selected via lightness_threshold.
- If a
number
, then that value will always be used. - If a
tuple
(a, b)
, then a value will be uniformly sampled per image from the discrete interval[a..b]
. - If a
list
, then a random value will be sampled from thatlist
per image. - If a
StochasticParameter
, then a value will be sampled per image from that parameter.
- If a
from_colorspace (str, optional) – The source colorspace of the input images. See
__init__()
.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.FastSnowyLandscape( >>> lightness_threshold=140, >>> lightness_multiplier=2.5 >>> )
Search for all pixels in the image with a lightness value in HLS colorspace of less than
140
and increase their lightness by a factor of2.5
.>>> aug = iaa.FastSnowyLandscape( >>> lightness_threshold=[128, 200], >>> lightness_multiplier=(1.5, 3.5) >>> )
Search for all pixels in the image with a lightness value in HLS colorspace of less than
128
or less than200
(one of these values is picked per image) and multiply their lightness by a factor ofx
withx
being sampled fromuniform(1.5, 3.5)
(once per image).>>> aug = iaa.FastSnowyLandscape( >>> lightness_threshold=(100, 255), >>> lightness_multiplier=(1.0, 4.0) >>> )
Similar to the previous example, but the lightness threshold is sampled from
uniform(100, 255)
(per image) and the multiplier fromuniform(1.0, 4.0)
(per image). This seems to produce good and varied results.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.weather.
Fog
(seed=None, name=None, random_state='deprecated', deterministic='deprecated')[source]¶ Bases:
imgaug.augmenters.weather.CloudLayer
Add fog to images.
This is a wrapper around
CloudLayer
. It executes a single layer per image with a configuration leading to fairly dense clouds with low-frequency patterns.This augmenter seems to be fairly robust w.r.t. the image size. Tested with
96x128
,192x256
and960x1280
.Supported dtypes:
uint8
: yes; testeduint16
: no (1)uint32
: no (1)uint64
: no (1)int8
: no (1)int16
: no (1)int32
: no (1)int64
: no (1)float16
: no (1)float32
: no (1)float64
: no (1)float128
: no (1)bool
: no (1)
- Parameters of this augmenter are optimized for the value range
of
uint8
. While other dtypes may be accepted, they will lead to images augmented in ways inappropriate for the respective dtype.
- Parameters of this augmenter are optimized for the value range
of
Parameters: - 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.Fog()
Create an augmenter that adds fog to images.
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. draw_on_image generate_maps
-
class
imgaug.augmenters.weather.
Rain
(nb_iterations=(1, 3), drop_size=(0.01, 0.02), speed=(0.04, 0.2), seed=None, name=None, random_state='deprecated', deterministic='deprecated')[source]¶ Bases:
imgaug.augmenters.meta.SomeOf
Add falling snowflakes to images.
This is a wrapper around
RainLayer
. It executes 1 to 3 layers per image.Note
This augmenter currently seems to work best for medium-sized images around
192x256
. For smaller images, you may want to increase the speed value to e.g.(0.1, 0.3)
, otherwise the drops tend to look like snowflakes. For larger images, you may want to increase the drop_size to e.g.(0.10, 0.20)
.Added in 0.4.0.
Supported dtypes:
uint8
: yes; testeduint16
: no (1)uint32
: no (1)uint64
: no (1)int8
: no (1)int16
: no (1)int32
: no (1)int64
: no (1)float16
: no (1)float32
: no (1)float64
: no (1)float128
: no (1)bool
: no (1)
- Parameters of this augmenter are optimized for the value range
of
uint8
. While other dtypes may be accepted, they will lead to images augmented in ways inappropriate for the respective dtype.
- Parameters of this augmenter are optimized for the value range
of
Parameters: - drop_size (number or tuple of number or list of number or imgaug.parameters.StochasticParameter) – See
RainLayer
. - speed (number or tuple of number or list of number or imgaug.parameters.StochasticParameter) – See
RainLayer
. - 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.Rain(speed=(0.1, 0.3))
Add rain to small images (around
96x128
).>>> aug = iaa.Rain()
Add rain to medium sized images (around
192x256
).>>> aug = iaa.Rain(drop_size=(0.10, 0.20))
Add rain to large images (around
960x1280
).Methods
__call__
(self, *args, **kwargs)Alias for augment()
.add
(self, augmenter)Add an augmenter to the list of child augmenters. append
(self, object, /)Append object to the end of the list. 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. clear
(self, /)Remove all items from list. 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). count
(self, value, /)Return number of occurrences of value. 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. extend
(self, iterable, /)Extend list by appending elements from the iterable. 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)See get_children_lists()
.get_parameters
(self)See get_parameters()
.index
(self, value[, start, stop])Return first index of value. insert
(self, index, object, /)Insert object before index. 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. pop
(self[, index])Remove and return item at index (default last). remove
(self, value, /)Remove first occurrence of value. 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. reverse
(self, /)Reverse IN PLACE. 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. sort
(self, /, *[, key, reverse])Stable sort IN PLACE. to_deterministic
(self[, n])Convert this augmenter from a stochastic to a deterministic one.
-
class
imgaug.augmenters.weather.
RainLayer
(density, density_uniformity, drop_size, drop_size_uniformity, angle, speed, blur_sigma_fraction, blur_sigma_limits=(0.5, 3.75), seed=None, name=None, random_state='deprecated', deterministic='deprecated')[source]¶ Bases:
imgaug.augmenters.weather.SnowflakesLayer
Add a single layer of falling raindrops to images.
Added in 0.4.0.
Supported dtypes:
uint8
: yes; indirectly tested (1)uint16
: nouint32
: nouint64
: noint8
: noint16
: noint32
: noint64
: nofloat16
: nofloat32
: nofloat64
: nofloat128
: nobool
: no
- indirectly tested via tests for
Rain
- indirectly tested via tests for
Parameters: - density (number or tuple of number or list of number or imgaug.parameters.StochasticParameter) – Same as in
SnowflakesLayer
. - density_uniformity (number or tuple of number or list of number or imgaug.parameters.StochasticParameter) – Same as in
SnowflakesLayer
. - drop_size (number or tuple of number or list of number or imgaug.parameters.StochasticParameter) – Same as flake_size in
SnowflakesLayer
. - drop_size_uniformity (number or tuple of number or list of number or imgaug.parameters.StochasticParameter) – Same as flake_size_uniformity in
SnowflakesLayer
. - angle (number or tuple of number or list of number or imgaug.parameters.StochasticParameter) – Same as in
SnowflakesLayer
. - speed (number or tuple of number or list of number or imgaug.parameters.StochasticParameter) – Same as in
SnowflakesLayer
. - blur_sigma_fraction (number or tuple of number or list of number or imgaug.parameters.StochasticParameter) – Same as in
SnowflakesLayer
. - blur_sigma_limits (tuple of float, optional) – Same as in
SnowflakesLayer
. - 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.
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. draw_on_image
-
class
imgaug.augmenters.weather.
Snowflakes
(density=(0.005, 0.075), density_uniformity=(0.3, 0.9), flake_size=(0.2, 0.7), flake_size_uniformity=(0.4, 0.8), angle=(-30, 30), speed=(0.007, 0.03), seed=None, name=None, random_state='deprecated', deterministic='deprecated')[source]¶ Bases:
imgaug.augmenters.meta.SomeOf
Add falling snowflakes to images.
This is a wrapper around
SnowflakesLayer
. It executes 1 to 3 layers per image.Supported dtypes:
uint8
: yes; testeduint16
: no (1)uint32
: no (1)uint64
: no (1)int8
: no (1)int16
: no (1)int32
: no (1)int64
: no (1)float16
: no (1)float32
: no (1)float64
: no (1)float128
: no (1)bool
: no (1)
- Parameters of this augmenter are optimized for the value range
of
uint8
. While other dtypes may be accepted, they will lead to images augmented in ways inappropriate for the respective dtype.
- Parameters of this augmenter are optimized for the value range
of
Parameters: density (number or tuple of number or list of number or imgaug.parameters.StochasticParameter) – Density of the snowflake layer, as a probability of each pixel in low resolution space to be a snowflake. Valid values are in the interval
[0.0, 1.0]
. Recommended to be in the interval[0.01, 0.075]
.- If a
number
, then that value will always be used. - If a
tuple
(a, b)
, then a value will be uniformly sampled per image from the interval[a, b]
. - If a
list
, then a random value will be sampled from thatlist
per image. - If a
StochasticParameter
, then a value will be sampled per image from that parameter.
- If a
density_uniformity (number or tuple of number or list of number or imgaug.parameters.StochasticParameter) – Size uniformity of the snowflakes. Higher values denote more similarly sized snowflakes. Valid values are in the interval
[0.0, 1.0]
. Recommended to be around0.5
.- If a
number
, then that value will always be used. - If a
tuple
(a, b)
, then a value will be uniformly sampled per image from the interval[a, b]
. - If a
list
, then a random value will be sampled from thatlist
per image. - If a
StochasticParameter
, then a value will be sampled per image from that parameter.
- If a
flake_size (number or tuple of number or list of number or imgaug.parameters.StochasticParameter) – Size of the snowflakes. This parameter controls the resolution at which snowflakes are sampled. Higher values mean that the resolution is closer to the input image’s resolution and hence each sampled snowflake will be smaller (because of the smaller pixel size).
Valid values are in the interval
(0.0, 1.0]
. Recommended values:- On
96x128
a value of(0.1, 0.4)
worked well. - On
192x256
a value of(0.2, 0.7)
worked well. - On
960x1280
a value of(0.7, 0.95)
worked well.
Datatype behaviour:
- If a
number
, then that value will always be used. - If a
tuple
(a, b)
, then a value will be uniformly sampled per image from the interval[a, b]
. - If a
list
, then a random value will be sampled from thatlist
per image. - If a
StochasticParameter
, then a value will be sampled per image from that parameter.
- On
flake_size_uniformity (number or tuple of number or list of number or imgaug.parameters.StochasticParameter) – Controls the size uniformity of the snowflakes. Higher values mean that the snowflakes are more similarly sized. Valid values are in the interval
[0.0, 1.0]
. Recommended to be around0.5
.- If a
number
, then that value will always be used. - If a
tuple
(a, b)
, then a value will be uniformly sampled per image from the interval[a, b]
. - If a
list
, then a random value will be sampled from thatlist
per image. - If a
StochasticParameter
, then a value will be sampled per image from that parameter.
- If a
angle (number or tuple of number or list of number or imgaug.parameters.StochasticParameter) – Angle in degrees of motion blur applied to the snowflakes, where
0.0
is motion blur that points straight upwards. Recommended to be in the interval[-30, 30]
. See also__init__()
.- If a
number
, then that value will always be used. - If a
tuple
(a, b)
, then a value will be uniformly sampled per image from the interval[a, b]
. - If a
list
, then a random value will be sampled from thatlist
per image. - If a
StochasticParameter
, then a value will be sampled per image from that parameter.
- If a
speed (number or tuple of number or list of number or imgaug.parameters.StochasticParameter) – Perceived falling speed of the snowflakes. This parameter controls the motion blur’s kernel size. It follows roughly the form
kernel_size = image_size * speed
. Hence, values around1.0
denote that the motion blur should “stretch” each snowflake over the whole image.Valid values are in the interval
[0.0, 1.0]
. Recommended values:- On
96x128
a value of(0.01, 0.05)
worked well. - On
192x256
a value of(0.007, 0.03)
worked well. - On
960x1280
a value of(0.001, 0.03)
worked well.
Datatype behaviour:
- If a
number
, then that value will always be used. - If a
tuple
(a, b)
, then a value will be uniformly sampled per image from the interval[a, b]
. - If a
list
, then a random value will be sampled from thatlist
per image. - If a
StochasticParameter
, then a value will be sampled per image from that parameter.
- On
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.Snowflakes(flake_size=(0.1, 0.4), speed=(0.01, 0.05))
Add snowflakes to small images (around
96x128
).>>> aug = iaa.Snowflakes(flake_size=(0.2, 0.7), speed=(0.007, 0.03))
Add snowflakes to medium-sized images (around
192x256
).>>> aug = iaa.Snowflakes(flake_size=(0.7, 0.95), speed=(0.001, 0.03))
Add snowflakes to large images (around
960x1280
).Methods
__call__
(self, *args, **kwargs)Alias for augment()
.add
(self, augmenter)Add an augmenter to the list of child augmenters. append
(self, object, /)Append object to the end of the list. 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. clear
(self, /)Remove all items from list. 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). count
(self, value, /)Return number of occurrences of value. 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. extend
(self, iterable, /)Extend list by appending elements from the iterable. 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)See get_children_lists()
.get_parameters
(self)See get_parameters()
.index
(self, value[, start, stop])Return first index of value. insert
(self, index, object, /)Insert object before index. 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. pop
(self[, index])Remove and return item at index (default last). remove
(self, value, /)Remove first occurrence of value. 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. reverse
(self, /)Reverse IN PLACE. 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. sort
(self, /, *[, key, reverse])Stable sort IN PLACE. to_deterministic
(self[, n])Convert this augmenter from a stochastic to a deterministic one.
-
class
imgaug.augmenters.weather.
SnowflakesLayer
(density, density_uniformity, flake_size, flake_size_uniformity, angle, speed, blur_sigma_fraction, blur_sigma_limits=(0.5, 3.75), seed=None, name=None, random_state='deprecated', deterministic='deprecated')[source]¶ Bases:
imgaug.augmenters.meta.Augmenter
Add a single layer of falling snowflakes to images.
Supported dtypes:
uint8
: yes; indirectly tested (1)uint16
: nouint32
: nouint64
: noint8
: noint16
: noint32
: noint64
: nofloat16
: nofloat32
: nofloat64
: nofloat128
: nobool
: no
- indirectly tested via tests for
Snowflakes
- indirectly tested via tests for
Parameters: density (number or tuple of number or list of number or imgaug.parameters.StochasticParameter) – Density of the snowflake layer, as a probability of each pixel in low resolution space to be a snowflake. Valid values are in the interval
[0.0, 1.0]
. Recommended to be in the interval[0.01, 0.075]
.- If a
number
, then that value will always be used. - If a
tuple
(a, b)
, then a value will be uniformly sampled per image from the interval[a, b]
. - If a
list
, then a random value will be sampled from thatlist
per image. - If a
StochasticParameter
, then a value will be sampled per image from that parameter.
- If a
density_uniformity (number or tuple of number or list of number or imgaug.parameters.StochasticParameter) – Size uniformity of the snowflakes. Higher values denote more similarly sized snowflakes. Valid values are in the interval
[0.0, 1.0]
. Recommended to be around0.5
.- If a
number
, then that value will always be used. - If a
tuple
(a, b)
, then a value will be uniformly sampled per image from the interval[a, b]
. - If a
list
, then a random value will be sampled from thatlist
per image. - If a
StochasticParameter
, then a value will be sampled per image from that parameter.
- If a
flake_size (number or tuple of number or list of number or imgaug.parameters.StochasticParameter) – Size of the snowflakes. This parameter controls the resolution at which snowflakes are sampled. Higher values mean that the resolution is closer to the input image’s resolution and hence each sampled snowflake will be smaller (because of the smaller pixel size).
Valid values are in the interval
(0.0, 1.0]
. Recommended values:- On 96x128 a value of
(0.1, 0.4)
worked well. - On 192x256 a value of
(0.2, 0.7)
worked well. - On 960x1280 a value of
(0.7, 0.95)
worked well.
Datatype behaviour:
- If a
number
, then that value will always be used. - If a
tuple
(a, b)
, then a value will be uniformly sampled per image from the interval[a, b]
. - If a
list
, then a random value will be sampled from thatlist
per image. - If a
StochasticParameter
, then a value will be sampled per image from that parameter.
- On 96x128 a value of
flake_size_uniformity (number or tuple of number or list of number or imgaug.parameters.StochasticParameter) – Controls the size uniformity of the snowflakes. Higher values mean that the snowflakes are more similarly sized. Valid values are in the interval
[0.0, 1.0]
. Recommended to be around0.5
.- If a
number
, then that value will always be used. - If a
tuple
(a, b)
, then a value will be uniformly sampled per image from the interval[a, b]
. - If a
list
, then a random value will be sampled from thatlist
per image. - If a
StochasticParameter
, then a value will be sampled per image from that parameter.
- If a
angle (number or tuple of number or list of number or imgaug.parameters.StochasticParameter) – Angle in degrees of motion blur applied to the snowflakes, where
0.0
is motion blur that points straight upwards. Recommended to be in the interval[-30, 30]
. See also__init__()
.- If a
number
, then that value will always be used. - If a
tuple
(a, b)
, then a value will be uniformly sampled per image from the interval[a, b]
. - If a
list
, then a random value will be sampled from thatlist
per image. - If a
StochasticParameter
, then a value will be sampled per image from that parameter.
- If a
speed (number or tuple of number or list of number or imgaug.parameters.StochasticParameter) – Perceived falling speed of the snowflakes. This parameter controls the motion blur’s kernel size. It follows roughly the form
kernel_size = image_size * speed
. Hence, values around1.0
denote that the motion blur should “stretch” each snowflake over the whole image.Valid values are in the interval
[0.0, 1.0]
. Recommended values:- On 96x128 a value of
(0.01, 0.05)
worked well. - On 192x256 a value of
(0.007, 0.03)
worked well. - On 960x1280 a value of
(0.001, 0.03)
worked well.
Datatype behaviour:
- If a
number
, then that value will always be used. - If a
tuple
(a, b)
, then a value will be uniformly sampled per image from the interval[a, b]
. - If a
list
, then a random value will be sampled from thatlist
per image. - If a
StochasticParameter
, then a value will be sampled per image from that parameter.
- On 96x128 a value of
blur_sigma_fraction (number or tuple of number or list of number or imgaug.parameters.StochasticParameter) – Standard deviation (as a fraction of the image size) of gaussian blur applied to the snowflakes. Valid values are in the interval
[0.0, 1.0]
. Recommended to be in the interval[0.0001, 0.001]
. May still require tinkering based on image size.- If a
number
, then that value will always be used. - If a
tuple
(a, b)
, then a value will be uniformly sampled per image from the interval[a, b]
. - If a
list
, then a random value will be sampled from thatlist
per image. - If a
StochasticParameter
, then a value will be sampled per image from that parameter.
- If a
blur_sigma_limits (tuple of float, optional) – Controls allowed min and max values of blur_sigma_fraction after(!) multiplication with the image size. First value is the minimum, second value is the maximum. Values outside of that range will be clipped to be within that range. This prevents extreme values for very small or large images.
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.
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. draw_on_image -
get_parameters
(self)[source]¶ See
get_parameters()
.