def Fog(name=None, deterministic=False, random_state=None):

if name is None:<EOL><INDENT>name = "<STR_LIT>" % (ia.caller_name(),)<EOL><DEDENT>return CloudLayer(<EOL>intensity_mean=(<NUM_LIT>, <NUM_LIT:255>), intensity_freq_exponent=(-<NUM_LIT>, -<NUM_LIT>), intensity_coarse_scale=<NUM_LIT:2>,<EOL>alpha_min=(<NUM_LIT>, <NUM_LIT>), alpha_multiplier=<NUM_LIT>, alpha_size_px_max=(<NUM_LIT:2>, <NUM_LIT:8>), alpha_freq_exponent=(-<NUM_LIT>, -<NUM_LIT>),<EOL>sparsity=<NUM_LIT>, density_multiplier=(<NUM_LIT>, <NUM_LIT>),<EOL>name=name, deterministic=deterministic, random_state=random_state<EOL>)<EOL>

Augmenter to draw fog in 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``
and ``960x1280``.

dtype support::

    * ``uint8``: yes; tested
    * ``uint16``: 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)

    - (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
----------
name : None or str, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

deterministic : bool, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

random_state : None or int or numpy.random.RandomState, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

Examples
--------
>>> aug = iaa.Fog()

Creates an augmenter that adds fog to images.


def Snowflakes(density=(<NUM_LIT>, <NUM_LIT>), density_uniformity=(<NUM_LIT>, <NUM_LIT>), flake_size=(<NUM_LIT>, <NUM_LIT>),<EOL>flake_size_uniformity=(<NUM_LIT>, <NUM_LIT>), angle=(-<NUM_LIT:30>, <NUM_LIT:30>), speed=(<NUM_LIT>, <NUM_LIT>),<EOL>name=None, deterministic=False, random_state=None):

if name is None:<EOL><INDENT>name = "<STR_LIT>" % (ia.caller_name(),)<EOL><DEDENT>layer = SnowflakesLayer(<EOL>density=density, density_uniformity=density_uniformity,<EOL>flake_size=flake_size, flake_size_uniformity=flake_size_uniformity,<EOL>angle=angle, speed=speed,<EOL>blur_sigma_fraction=(<NUM_LIT>, <NUM_LIT>)<EOL>)<EOL>return meta.SomeOf(<EOL>(<NUM_LIT:1>, <NUM_LIT:3>), children=[layer.deepcopy() for _ in range(<NUM_LIT:3>)],<EOL>random_order=False, name=name, deterministic=deterministic, random_state=random_state<EOL>)<EOL>

Augmenter to add falling snowflakes to images.

This is a wrapper around ``SnowflakesLayer``. It executes 1 to 3 layers per image.

dtype support::

    * ``uint8``: yes; tested
    * ``uint16``: 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)

    - (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
----------
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 value range is ``(0.0, 1.0)``. Recommended to be around ``(0.01, 0.075)``.

        * If a number, then that value will be used for all images.
        * If a tuple ``(a, b)``, then a value from the continuous range ``[a, b]`` will be used.
        * If a list, then a random value will be sampled from that list per image.
        * If a StochasticParameter, then a value will be sampled per image from that parameter.

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 value range is ``(0.0, 1.0)``. Recommended to be around ``0.5``.

        * If a number, then that value will be used for all images.
        * If a tuple ``(a, b)``, then a value from the continuous range ``[a, b]`` will be used.
        * If a list, then a random value will be sampled from that list per image.
        * If a StochasticParameter, then a value will be sampled per image from that parameter.

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 value range is ``[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.

    Allowed datatypes:

        * If a number, then that value will be used for all images.
        * If a tuple ``(a, b)``, then a value from the continuous range ``[a, b]`` will be used.
        * If a list, then a random value will be sampled from that list per image.
        * If a StochasticParameter, then a value will be sampled per image from that parameter.

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 value range is ``(0.0, 1.0)``. Recommended to be around ``0.5``.

        * If a number, then that value will be used for all images.
        * If a tuple ``(a, b)``, then a value from the continuous range ``[a, b]`` will be used.
        * If a list, then a random value will be sampled from that list per image.
        * If a StochasticParameter, then a value will be sampled per image from that parameter.

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 around ``(-30, 30)``.
    See also :func:`imgaug.augmenters.blur.MotionBlur.__init__`.

        * If a number, then that value will be used for all images.
        * If a tuple ``(a, b)``, then a value from the continuous range ``[a, b]`` will be used.
        * If a list, then a random value will be sampled from that list per image.
        * If a StochasticParameter, then a value will be sampled per image from that parameter.

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 around ``1.0`` denote that the motion blur should "stretch" each snowflake over the whole image.

    Valid value range is ``(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.

    Allowed datatypes:

        * If a number, then that value will be used for all images.
        * If a tuple ``(a, b)``, then a value from the continuous range ``[a, b]`` will be used.
        * If a list, then a random value will be sampled from that list per image.
        * If a StochasticParameter, then a value will be sampled per image from that parameter.

name : None or str, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

deterministic : bool, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

random_state : None or int or numpy.random.RandomState, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

Examples
--------
>>> aug = iaa.Snowflakes(flake_size=(0.1, 0.4), speed=(0.01, 0.05))

Adds snowflakes to small images (around ``96x128``).

>>> aug = iaa.Snowflakes(flake_size=(0.2, 0.7), speed=(0.007, 0.03))

Adds snowflakes to medium-sized images (around ``192x256``).

>>> aug = iaa.Snowflakes(flake_size=(0.7, 0.95), speed=(0.001, 0.03))

Adds snowflakes to large images (around ``960x1280``).


@classmethod<EOL><INDENT>def map_coordinates(cls, image, dx, dy, order=<NUM_LIT:1>, cval=<NUM_LIT:0>, mode="<STR_LIT>"):<DEDENT>

if order == <NUM_LIT:0> and image.dtype.name in ["<STR_LIT>", "<STR_LIT>"]:<EOL><INDENT>raise Exception(("<STR_LIT>"<EOL>+ "<STR_LIT>") % (order, image.dtype.name))<EOL><DEDENT>input_dtype = image.dtype<EOL>if image.dtype.name == "<STR_LIT:bool>":<EOL><INDENT>image = image.astype(np.float32)<EOL><DEDENT>elif order == <NUM_LIT:1> and image.dtype.name in ["<STR_LIT>", "<STR_LIT>", "<STR_LIT>"]:<EOL><INDENT>image = image.astype(np.float64)<EOL><DEDENT>elif order >= <NUM_LIT:2> and image.dtype.name == "<STR_LIT>":<EOL><INDENT>image = image.astype(np.int16)<EOL><DEDENT>elif order >= <NUM_LIT:2> and image.dtype.name == "<STR_LIT>":<EOL><INDENT>image = image.astype(np.float64)<EOL><DEDENT>shrt_max = <NUM_LIT><EOL>backend = "<STR_LIT>"<EOL>if order == <NUM_LIT:0>:<EOL><INDENT>bad_dtype_cv2 = (image.dtype.name in ["<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT:bool>"])<EOL><DEDENT>elif order == <NUM_LIT:1>:<EOL><INDENT>bad_dtype_cv2 = (image.dtype.name in ["<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT:bool>"])<EOL><DEDENT>else:<EOL><INDENT>bad_dtype_cv2 = (image.dtype.name in ["<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT:bool>"])<EOL><DEDENT>bad_dx_shape_cv2 = (dx.shape[<NUM_LIT:0>] >= shrt_max or dx.shape[<NUM_LIT:1>] >= shrt_max)<EOL>bad_dy_shape_cv2 = (dy.shape[<NUM_LIT:0>] >= shrt_max or dy.shape[<NUM_LIT:1>] >= shrt_max)<EOL>if bad_dtype_cv2 or bad_dx_shape_cv2 or bad_dy_shape_cv2:<EOL><INDENT>backend = "<STR_LIT>"<EOL><DEDENT>ia.do_assert(image.ndim == <NUM_LIT:3>)<EOL>result = np.copy(image)<EOL>height, width = image.shape[<NUM_LIT:0>:<NUM_LIT:2>]<EOL>if backend == "<STR_LIT>":<EOL><INDENT>h, w = image.shape[<NUM_LIT:0>:<NUM_LIT:2>]<EOL>y, x = np.meshgrid(np.arange(h).astype(np.float32), np.arange(w).astype(np.float32), indexing='<STR_LIT>')<EOL>x_shifted = x + (-<NUM_LIT:1>) * dx<EOL>y_shifted = y + (-<NUM_LIT:1>) * dy<EOL>for c in sm.xrange(image.shape[<NUM_LIT:2>]):<EOL><INDENT>remapped_flat = ndimage.interpolation.map_coordinates(<EOL>image[..., c],<EOL>(y_shifted.flatten(), x_shifted.flatten()),<EOL>order=order,<EOL>cval=cval,<EOL>mode=mode<EOL>)<EOL>remapped = remapped_flat.reshape((height, width))<EOL>result[..., c] = remapped<EOL><DEDENT><DEDENT>else:<EOL><INDENT>h, w, nb_channels = image.shape<EOL>y, x = np.meshgrid(np.arange(h).astype(np.float32), np.arange(w).astype(np.float32), indexing='<STR_LIT>')<EOL>x_shifted = x + (-<NUM_LIT:1>) * dx<EOL>y_shifted = y + (-<NUM_LIT:1>) * dy<EOL>if image.dtype.kind == "<STR_LIT:f>":<EOL><INDENT>cval = float(cval)<EOL><DEDENT>else:<EOL><INDENT>cval = int(cval)<EOL><DEDENT>border_mode = cls._MAPPING_MODE_SCIPY_CV2[mode]<EOL>interpolation = cls._MAPPING_ORDER_SCIPY_CV2[order]<EOL>is_nearest_neighbour = (interpolation == cv2.INTER_NEAREST)<EOL>map1, map2 = cv2.convertMaps(x_shifted, y_shifted, cv2.CV_16SC2, nninterpolation=is_nearest_neighbour)<EOL>if nb_channels <= <NUM_LIT:4>:<EOL><INDENT>result = cv2.remap(image, map1, map2, interpolation=interpolation, borderMode=border_mode, borderValue=cval)<EOL>if image.ndim == <NUM_LIT:3> and result.ndim == <NUM_LIT:2>:<EOL><INDENT>result = result[..., np.newaxis]<EOL><DEDENT><DEDENT>else:<EOL><INDENT>current_chan_idx = <NUM_LIT:0><EOL>result = []<EOL>while current_chan_idx < nb_channels:<EOL><INDENT>channels = image[..., current_chan_idx:current_chan_idx+<NUM_LIT:4>]<EOL>result_c =  cv2.remap(channels, map1, map2, interpolation=interpolation, borderMode=border_mode,<EOL>borderValue=cval)<EOL>if result_c.ndim == <NUM_LIT:2>:<EOL><INDENT>result_c = result_c[..., np.newaxis]<EOL><DEDENT>result.append(result_c)<EOL>current_chan_idx += <NUM_LIT:4><EOL><DEDENT>result = np.concatenate(result, axis=<NUM_LIT:2>)<EOL><DEDENT><DEDENT>if result.dtype.name != input_dtype.name:<EOL><INDENT>result = iadt.restore_dtypes_(result, input_dtype)<EOL><DEDENT>return result<EOL>

backend="scipy"

    order=0
        * uint8: yes
        * uint16: yes
        * uint32: yes
        * uint64: no (produces array filled with only 0)
        * int8: yes
        * int16: yes
        * int32: yes
        * int64: no (produces array filled with <min_value> when testing with <max_value>)
        * float16: yes
        * float32: yes
        * float64: yes
        * float128: no (causes: 'data type no supported')
        * bool: yes

    order=1 to 5
        * uint*, int*: yes (rather loose test, to avoid having to re-compute the interpolation)
        * float16 - float64: yes (rather loose test, to avoid having to re-compute the interpolation)
        * float128: no (causes: 'data type no supported')
        * bool: yes

backend="cv2"

    order=0
        * uint8: yes
        * uint16: yes
        * uint32: no (causes: src data type = 6 is not supported)
        * uint64: no (silently converts to int32)
        * int8: yes
        * int16: yes
        * int32: yes
        * int64: no (silently converts to int32)
        * float16: yes
        * float32: yes
        * float64: yes
        * float128: no (causes: src data type = 13 is not supported)
        * bool: no (causes: src data type = 0 is not supported)

    order=1
        * uint8: yes
        * uint16: yes
        * uint32: no (causes: src data type = 6 is not supported)
        * uint64: no (causes: OpenCV(3.4.5) (...)/imgwarp.cpp:1805: error: (-215:Assertion failed) ifunc != 0
          in function 'remap')
        * int8: no (causes: OpenCV(3.4.5) (...)/imgwarp.cpp:1805: error: (-215:Assertion failed) ifunc != 0
          in function 'remap')
        * int16: no (causes: OpenCV(3.4.5) (...)/imgwarp.cpp:1805: error: (-215:Assertion failed) ifunc != 0
          in function 'remap')
        * int32: no (causes: OpenCV(3.4.5) (...)/imgwarp.cpp:1805: error: (-215:Assertion failed) ifunc != 0
          in function 'remap')
        * int64: no (causes: OpenCV(3.4.5) (...)/imgwarp.cpp:1805: error: (-215:Assertion failed) ifunc != 0
          in function 'remap')
        * float16: yes
        * float32: yes
        * float64: yes
        * float128: no (causes: src data type = 13 is not supported)
        * bool: no (causes: src data type = 0 is not supported)

    order=2 to 5:
        as order=1, but int16 supported


def blur_gaussian_(image, sigma, ksize=None, backend="<STR_LIT>", eps=<NUM_LIT>):

if sigma > <NUM_LIT:0> + eps:<EOL><INDENT>dtype = image.dtype<EOL>iadt.gate_dtypes(image,<EOL>allowed=["<STR_LIT:bool>",<EOL>"<STR_LIT>", "<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>", "<STR_LIT>", "<STR_LIT>"],<EOL>disallowed=["<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>", "<STR_LIT>", "<STR_LIT>"],<EOL>augmenter=None)<EOL>dts_not_supported_by_cv2 = ["<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>"]<EOL>backend_to_use = backend<EOL>if backend == "<STR_LIT>":<EOL><INDENT>backend_to_use = "<STR_LIT>" if image.dtype.name not in dts_not_supported_by_cv2 else "<STR_LIT>"<EOL><DEDENT>elif backend == "<STR_LIT>":<EOL><INDENT>assert image.dtype.name not in dts_not_supported_by_cv2,("<STR_LIT>"<EOL>+ "<STR_LIT>"<EOL>+ "<STR_LIT>") % (image.dtype.name,)<EOL><DEDENT>elif backend == "<STR_LIT>":<EOL><INDENT>pass<EOL><DEDENT>if backend_to_use == "<STR_LIT>":<EOL><INDENT>if dtype.name == "<STR_LIT:bool>":<EOL><INDENT>image = image.astype(np.float32, copy=False)<EOL><DEDENT>elif dtype.name == "<STR_LIT>":<EOL><INDENT>image = image.astype(np.float32, copy=False)<EOL><DEDENT>if ksize is not None:<EOL><INDENT>warnings.warn("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>if image.ndim == <NUM_LIT:2>:<EOL><INDENT>image[:, :] = ndimage.gaussian_filter(image[:, :], sigma, mode="<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>nb_channels = image.shape[<NUM_LIT:2>]<EOL>for channel in sm.xrange(nb_channels):<EOL><INDENT>image[:, :, channel] = ndimage.gaussian_filter(image[:, :, channel], sigma, mode="<STR_LIT>")<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>if dtype.name == "<STR_LIT:bool>":<EOL><INDENT>image = image.astype(np.float32, copy=False)<EOL><DEDENT>elif dtype.name == "<STR_LIT>":<EOL><INDENT>image = image.astype(np.float32, copy=False)<EOL><DEDENT>elif dtype.name == "<STR_LIT>":<EOL><INDENT>image = image.astype(np.int16, copy=False)<EOL><DEDENT>elif dtype.name == "<STR_LIT>":<EOL><INDENT>image = image.astype(np.float64, copy=False)<EOL><DEDENT>if ksize is None:<EOL><INDENT>if sigma < <NUM_LIT>:<EOL><INDENT>ksize = <NUM_LIT> * sigma  <EOL><DEDENT>elif sigma < <NUM_LIT>:<EOL><INDENT>ksize = <NUM_LIT> * sigma  <EOL><DEDENT>else:<EOL><INDENT>ksize = <NUM_LIT> * sigma  <EOL><DEDENT>ksize = int(max(ksize, <NUM_LIT:5>))<EOL><DEDENT>else:<EOL><INDENT>assert ia.is_single_integer(ksize), "<STR_LIT>" % (type(ksize),)<EOL><DEDENT>ksize = ksize + <NUM_LIT:1> if ksize % <NUM_LIT:2> == <NUM_LIT:0> else ksize<EOL>if ksize > <NUM_LIT:0>:<EOL><INDENT>image_warped = cv2.GaussianBlur(image, (ksize, ksize), sigmaX=sigma, sigmaY=sigma,<EOL>borderType=cv2.BORDER_REFLECT_101)<EOL>image = image_warped[..., np.newaxis] if image.ndim == <NUM_LIT:3> and image_warped.ndim == <NUM_LIT:2> else image_warped<EOL><DEDENT><DEDENT>if dtype.name == "<STR_LIT:bool>":<EOL><INDENT>image = image > <NUM_LIT:0.5><EOL><DEDENT>elif dtype.name != image.dtype.name:<EOL><INDENT>image = iadt.restore_dtypes_(image, dtype)<EOL><DEDENT><DEDENT>return image<EOL>

Blur an image using gaussian blurring.

This operation might change the input image in-place.

dtype support::

    if (backend="auto")::

        * ``uint8``: yes; fully tested (1)
        * ``uint16``: yes; tested (1)
        * ``uint32``: yes; tested (2)
        * ``uint64``: yes; tested (2)
        * ``int8``: yes; tested (1)
        * ``int16``: yes; tested (1)
        * ``int32``: yes; tested (1)
        * ``int64``: yes; tested (2)
        * ``float16``: yes; tested (1)
        * ``float32``: yes; tested (1)
        * ``float64``: yes; tested (1)
        * ``float128``: no
        * ``bool``: yes; tested (1)

        - (1) Handled by ``cv2``. See ``backend="cv2"``.
        - (2) Handled by ``scipy``. See ``backend="scipy"``.

    if (backend="cv2")::

        * ``uint8``: yes; fully tested
        * ``uint16``: yes; tested
        * ``uint32``: no (2)
        * ``uint64``: no (3)
        * ``int8``: yes; tested (4)
        * ``int16``: yes; tested
        * ``int32``: yes; tested (5)
        * ``int64``: no (6)
        * ``float16``: yes; tested (7)
        * ``float32``: yes; tested
        * ``float64``: yes; tested
        * ``float128``: no (8)
        * ``bool``: yes; tested (1)

        - (1) Mapped internally to ``float32``. Otherwise causes ``TypeError: src data type = 0 is not supported``.
        - (2) Causes ``TypeError: src data type = 6 is not supported``.
        - (3) Causes ``cv2.error: OpenCV(3.4.5) (...)/filter.cpp:2957: error: (-213:The function/feature is not
              implemented) Unsupported combination of source format (=4), and buffer format (=5) in function
              'getLinearRowFilter'``.
        - (4) Mapped internally to ``int16``. Otherwise causes ``cv2.error: OpenCV(3.4.5) (...)/filter.cpp:2957:
              error: (-213:The function/feature is not implemented) Unsupported combination of source format (=1),
              and buffer format (=5) in function 'getLinearRowFilter'``.
        - (5) Mapped internally to ``float64``. Otherwise causes ``cv2.error: OpenCV(3.4.5) (...)/filter.cpp:2957:
              error: (-213:The function/feature is not implemented) Unsupported combination of source format (=4),
              and buffer format (=5) in function 'getLinearRowFilter'``.
        - (6) Causes ``cv2.error: OpenCV(3.4.5) (...)/filter.cpp:2957: error: (-213:The function/feature is not
              implemented) Unsupported combination of source format (=4), and buffer format (=5) in function
              'getLinearRowFilter'``.
        - (7) Mapped internally to ``float32``. Otherwise causes ``TypeError: src data type = 23 is not supported``.
        - (8) Causes ``TypeError: src data type = 13 is not supported``.

    if (backend="scipy")::

        * ``uint8``: yes; fully tested
        * ``uint16``: yes; tested
        * ``uint32``: yes; tested
        * ``uint64``: yes; tested
        * ``int8``: yes; tested
        * ``int16``: yes; tested
        * ``int32``: yes; tested
        * ``int64``: yes; tested
        * ``float16``: yes; tested (1)
        * ``float32``: yes; tested
        * ``float64``: yes; tested
        * ``float128``: no (2)
        * ``bool``: yes; tested (3)

        - (1) Mapped internally to ``float32``. Otherwise causes ``RuntimeError: array type dtype('float16')
              not supported``.
        - (2) Causes ``RuntimeError: array type dtype('float128') not supported``.
        - (3) Mapped internally to ``float32``. Otherwise too inaccurate.

Parameters
----------
image : numpy.ndarray
    The image to blur. Expected to be of shape ``(H, W)`` or ``(H, W, C)``.

sigma : number
    Standard deviation of the gaussian blur. Larger numbers result in more large-scale blurring, which is overall
    slower than small-scale blurring.

ksize : None or int, optional
    Size in height/width of the gaussian kernel. This argument is only understood by the ``cv2`` backend.
    If it is set to None, an appropriate value for `ksize` will automatically be derived from `sigma`.
    The value is chosen tighter for larger sigmas to avoid as much as possible very large kernel sizes
    and therey improve performance.

backend : {'auto', 'cv2', 'scipy'}, optional
    Backend library to use. If ``auto``, then the likely best library will be automatically picked per image. That
    is usually equivalent to ``cv2`` (OpenCV) and it will fall back to ``scipy`` for datatypes not supported by
    OpenCV.

eps : number, optional
    A threshold used to decide whether `sigma` can be considered zero.

Returns
-------
image : numpy.ndarray
    The blurred image. Same shape and dtype as the input.


def MotionBlur(k=<NUM_LIT:5>, angle=(<NUM_LIT:0>, <NUM_LIT>), direction=(-<NUM_LIT:1.0>, <NUM_LIT:1.0>), order=<NUM_LIT:1>, name=None, deterministic=False, random_state=None):

<EOL>k_param = iap.handle_discrete_param(k, "<STR_LIT:k>", value_range=(<NUM_LIT:3>, None), tuple_to_uniform=True, list_to_choice=True,<EOL>allow_floats=False)<EOL>angle_param = iap.handle_continuous_param(angle, "<STR_LIT>", value_range=None, tuple_to_uniform=True,<EOL>list_to_choice=True)<EOL>direction_param = iap.handle_continuous_param(direction, "<STR_LIT>", value_range=(-<NUM_LIT:1.0>-<NUM_LIT>, <NUM_LIT:1.0>+<NUM_LIT>),<EOL>tuple_to_uniform=True, list_to_choice=True)<EOL>def create_matrices(image, nb_channels, random_state_func):<EOL><INDENT>from . import geometric as iaa_geometric<EOL>k_sample = int(k_param.draw_sample(random_state=random_state_func))<EOL>angle_sample = angle_param.draw_sample(random_state=random_state_func)<EOL>direction_sample = direction_param.draw_sample(random_state=random_state_func)<EOL>k_sample = k_sample if k_sample % <NUM_LIT:2> != <NUM_LIT:0> else k_sample + <NUM_LIT:1><EOL>direction_sample = np.clip(direction_sample, -<NUM_LIT:1.0>, <NUM_LIT:1.0>)<EOL>direction_sample = (direction_sample + <NUM_LIT:1.0>) / <NUM_LIT><EOL>matrix = np.zeros((k_sample, k_sample), dtype=np.float32)<EOL>matrix[:, k_sample//<NUM_LIT:2>] = np.linspace(float(direction_sample), <NUM_LIT:1.0> - float(direction_sample), num=k_sample)<EOL>rot = iaa_geometric.Affine(rotate=angle_sample, order=order)<EOL>matrix = (rot.augment_image((matrix * <NUM_LIT:255>).astype(np.uint8)) / <NUM_LIT>).astype(np.float32)<EOL>return [matrix/np.sum(matrix)] * nb_channels<EOL><DEDENT>if name is None:<EOL><INDENT>name = "<STR_LIT>" % (ia.caller_name(),)<EOL><DEDENT>return iaa_convolutional.Convolve(create_matrices, name=name, deterministic=deterministic,<EOL>random_state=random_state)<EOL>

Augmenter that sharpens images and overlays the result with the original image.

dtype support::

    See ``imgaug.augmenters.convolutional.Convolve``.

Parameters
----------
k : int or tuple of int or list of int or imgaug.parameters.StochasticParameter, optional
    Kernel size to use.

        * If a single int, then that value will be used for the height
          and width of the kernel.
        * If a tuple of two ints ``(a, b)``, then the kernel size will be
          sampled from the interval ``[a..b]``.
        * If a list, then a random value will be sampled from that list per image.
        * If a StochasticParameter, then ``N`` samples will be drawn from
          that parameter per ``N`` input images, each representing the kernel
          size for the nth image.

angle : number or tuple of number or list of number or imgaug.parameters.StochasticParameter, optional
    Angle of the motion blur in degrees (clockwise, relative to top center direction).

        * If a number, exactly that value will be used.
        * If a tuple ``(a, b)``, a random value from the range ``a <= x <= b`` will
          be sampled per image.
        * If a list, then a random value will be sampled from that list per image.
        * If a StochasticParameter, a value will be sampled from the
          parameter per image.

direction : number or tuple of number or list of number or imgaug.parameters.StochasticParameter, optional
    Forward/backward direction of the motion blur. Lower values towards -1.0 will point the motion blur towards
    the back (with angle provided via `angle`). Higher values towards 1.0 will point the motion blur forward.
    A value of 0.0 leads to a uniformly (but still angled) motion blur.

        * If a number, exactly that value will be used.
        * If a tuple ``(a, b)``, a random value from the range ``a <= x <= b`` will
          be sampled per image.
        * If a list, then a random value will be sampled from that list per image.
        * If a StochasticParameter, a value will be sampled from the
          parameter per image.

order : int or iterable of int or imgaug.ALL or imgaug.parameters.StochasticParameter, optional
    Interpolation order to use when rotating the kernel according to `angle`.
    See :func:`imgaug.augmenters.geometric.Affine.__init__`.
    Recommended to be ``0`` or ``1``, with ``0`` being faster, but less continuous/smooth as `angle` is changed,
    particularly around multiple of 45 degrees.

name : None or str, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

deterministic : bool, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

random_state : None or int or numpy.random.RandomState, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

Examples
--------
>>> aug = iaa.MotionBlur(k=15)

Create a motion blur augmenter with kernel size of 15x15.

>>> aug = iaa.MotionBlur(k=15, angle=[-45, 45])

Create a motion blur augmenter with kernel size of 15x15 and a blur angle of either -45 or 45 degrees (randomly
picked per image).


def Pad(px=None, percent=None, pad_mode="<STR_LIT>", pad_cval=<NUM_LIT:0>, keep_size=True, sample_independently=True,<EOL>name=None, deterministic=False, random_state=None):

def recursive_validate(v):<EOL><INDENT>if v is None:<EOL><INDENT>return v<EOL><DEDENT>elif ia.is_single_number(v):<EOL><INDENT>ia.do_assert(v >= <NUM_LIT:0>)<EOL>return v<EOL><DEDENT>elif isinstance(v, iap.StochasticParameter):<EOL><INDENT>return v<EOL><DEDENT>elif isinstance(v, tuple):<EOL><INDENT>return tuple([recursive_validate(v_) for v_ in v])<EOL><DEDENT>elif isinstance(v, list):<EOL><INDENT>return [recursive_validate(v_) for v_ in v]<EOL><DEDENT>else:<EOL><INDENT>raise Exception("<STR_LIT>" % (<EOL>type(v),))<EOL><DEDENT><DEDENT>px = recursive_validate(px)<EOL>percent = recursive_validate(percent)<EOL>if name is None:<EOL><INDENT>name = "<STR_LIT>" % (ia.caller_name(),)<EOL><DEDENT>aug = CropAndPad(<EOL>px=px, percent=percent,<EOL>pad_mode=pad_mode, pad_cval=pad_cval,<EOL>keep_size=keep_size, sample_independently=sample_independently,<EOL>name=name, deterministic=deterministic, random_state=random_state<EOL>)<EOL>return aug<EOL>

Augmenter that pads images, i.e. adds columns/rows to them.

dtype support::

    See ``imgaug.augmenters.size.CropAndPad``.

Parameters
----------
px : None or int or imgaug.parameters.StochasticParameter or tuple, optional
    The number of pixels to pad on each side of the image.
    Either this or the parameter `percent` may be set, not both at the same
    time.

        * If None, then pixel-based padding will not be used.
        * If int, then that exact number of pixels will always be padded.
        * If StochasticParameter, then that parameter will be used for each
          image. Four samples will be drawn per image (top, right, bottom,
          left).
        * If a tuple of two ints with values a and b, then each side will
          be padded by a random amount in the range ``a <= x <= b``.
          ``x`` is sampled per image side.
        * If a tuple of four entries, then the entries represent top, right,
          bottom, left. Each entry may be a single integer (always pad by
          exactly that value), a tuple of two ints ``a`` and ``b`` (pad by
          an amount ``a <= x <= b``), a list of ints (pad by a random value
          that is contained in the list) or a StochasticParameter (sample
          the amount to pad from that parameter).

percent : None or int or float or imgaug.parameters.StochasticParameter \
          or tuple, optional
    The number of pixels to pad on each side of the image given
    *in percent* of the image height/width.
    E.g. if this is set to 0.1, the augmenter will always add 10 percent
    of the image's height to the top, 10 percent of the width to the right,
    10 percent of the height at the bottom and 10 percent of the width to
    the left. Either this or the parameter `px` may be set, not both at the
    same time.

        * If None, then percent-based padding will not be used.
        * If int, then expected to be 0 (no padding).
        * If float, then that percentage will always be padded.
        * If StochasticParameter, then that parameter will be used for each
          image. Four samples will be drawn per image (top, right, bottom,
          left).
        * If a tuple of two floats with values a and b, then each side will
          be padded by a random percentage in the range ``a <= x <= b``.
          ``x`` is sampled per image side.
        * If a tuple of four entries, then the entries represent top, right,
          bottom, left. Each entry may be a single float (always pad by
          exactly that percent value), a tuple of two floats ``a`` and ``b``
          (pad by a percentage ``a <= x <= b``), a list of floats (pad by a
          random value that is contained in the list) or a
          StochasticParameter (sample the percentage to pad from that
          parameter).

pad_mode : imgaug.ALL or str or list of str or \
           imgaug.parameters.StochasticParameter, optional
    Padding mode to use. The available modes match the numpy padding modes,
    i.e. ``constant``, ``edge``, ``linear_ramp``, ``maximum``, ``median``,
    ``minimum``, ``reflect``, ``symmetric``, ``wrap``. The modes
    ``constant`` and ``linear_ramp`` use extra values, which are provided
    by ``pad_cval`` when necessary. See :func:`imgaug.imgaug.pad` for
    more details.

        * If ``imgaug.ALL``, then a random mode from all available modes
          will be sampled per image.
        * If a string, it will be used as the pad mode for all images.
        * If a list of strings, a random one of these will be sampled per
          image and used as the mode.
        * If StochasticParameter, a random mode will be sampled from this
          parameter per image.

pad_cval : number or tuple of number list of number or \
           imgaug.parameters.StochasticParameter, optional
    The constant value to use if the pad mode is ``constant`` or the end
    value to use if the mode is ``linear_ramp``.
    See :func:`imgaug.imgaug.pad` for more details.

        * If number, then that value will be used.
        * If a tuple of two numbers and at least one of them is a float,
          then a random number will be sampled from the continuous range
          ``a <= x <= b`` and used as the value. If both numbers are
          integers, the range is discrete.
        * If a list of number, then a random value will be chosen from the
          elements of the list and used as the value.
        * If StochasticParameter, a random value will be sampled from that
          parameter per image.

keep_size : bool, optional
    After padding, the result image will usually have a different
    height/width compared to the original input image. If this parameter is
    set to True, then the padded image will be resized to the input image's
    size, i.e. the augmenter's output shape is always identical to the
    input shape.

sample_independently : bool, optional
    If False AND the values for `px`/`percent` result in exactly one
    probability distribution for the amount to pad, only one single value
    will be sampled from that probability distribution and used for all
    sides. I.e. the pad amount then is the same for all sides.

name : None or str, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

deterministic : bool, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

random_state : None or int or numpy.random.RandomState, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

Examples
--------
>>> aug = iaa.Pad(px=(0, 10))

pads each side by a random value from the range 0px to 10px (the value
is sampled per side). The added rows/columns are filled with black pixels.

>>> aug = iaa.Pad(px=(0, 10), sample_independently=False)

samples one value v from the discrete range ``[0..10]`` and pads all sides
by ``v`` pixels.

>>> aug = iaa.Pad(px=(0, 10), keep_size=False)

pads each side by a random value from the range 0px to 10px (the value
is sampled per side). After padding, the images are NOT resized to their
original size (i.e. the images may end up having different heights/widths).

>>> aug = iaa.Pad(px=((0, 10), (0, 5), (0, 10), (0, 5)))

pads the top and bottom by a random value from the range 0px to 10px
and the left and right by a random value in the range 0px to 5px.

>>> aug = iaa.Pad(percent=(0, 0.1))

pads each side by a random value from the range 0 percent to
10 percent. (Percent with respect to the side's size, e.g. for the
top side it uses the image's height.)

>>> aug = iaa.Pad(percent=([0.05, 0.1], [0.05, 0.1], [0.05, 0.1], [0.05, 0.1]))

pads each side by either 5 percent or 10 percent.

>>> aug = iaa.Pad(px=(0, 10), pad_mode="edge")

pads each side by a random value from the range 0px to 10px (the values
are sampled per side). The padding uses the ``edge`` mode from numpy's
pad function.

>>> aug = iaa.Pad(px=(0, 10), pad_mode=["constant", "edge"])

pads each side by a random value from the range 0px to 10px (the values
are sampled per side). The padding uses randomly either the ``constant``
or ``edge`` mode from numpy's pad function.

>>> aug = iaa.Pad(px=(0, 10), pad_mode=ia.ALL, pad_cval=(0, 255))

pads each side by a random value from the range 0px to 10px (the values
are sampled per side). It uses a random mode for numpy's pad function.
If the mode is ``constant`` or ``linear_ramp``, it samples a random value
``v`` from the range ``[0, 255]`` and uses that as the constant
value (``mode=constant``) or end value (``mode=linear_ramp``).


def Crop(px=None, percent=None, keep_size=True, sample_independently=True,<EOL>name=None, deterministic=False, random_state=None):

def recursive_negate(v):<EOL><INDENT>if v is None:<EOL><INDENT>return v<EOL><DEDENT>elif ia.is_single_number(v):<EOL><INDENT>ia.do_assert(v >= <NUM_LIT:0>)<EOL>return -v<EOL><DEDENT>elif isinstance(v, iap.StochasticParameter):<EOL><INDENT>return iap.Multiply(v, -<NUM_LIT:1>)<EOL><DEDENT>elif isinstance(v, tuple):<EOL><INDENT>return tuple([recursive_negate(v_) for v_ in v])<EOL><DEDENT>elif isinstance(v, list):<EOL><INDENT>return [recursive_negate(v_) for v_ in v]<EOL><DEDENT>else:<EOL><INDENT>raise Exception("<STR_LIT>" % (<EOL>type(v),))<EOL><DEDENT><DEDENT>px = recursive_negate(px)<EOL>percent = recursive_negate(percent)<EOL>if name is None:<EOL><INDENT>name = "<STR_LIT>" % (ia.caller_name(),)<EOL><DEDENT>aug = CropAndPad(<EOL>px=px, percent=percent,<EOL>keep_size=keep_size, sample_independently=sample_independently,<EOL>name=name, deterministic=deterministic, random_state=random_state<EOL>)<EOL>return aug<EOL>

Augmenter that crops/cuts away pixels at the sides of the image.

That allows to cut out subimages from given (full) input images.
The number of pixels to cut off may be defined in absolute values or
percent of the image sizes.

dtype support::

    See ``imgaug.augmenters.size.CropAndPad``.

Parameters
----------
px : None or int or imgaug.parameters.StochasticParameter or tuple, optional
    The number of pixels to crop away (cut off) on each side of the image.
    Either this or the parameter `percent` may be set, not both at the same
    time.

        * If None, then pixel-based cropping will not be used.
        * If int, then that exact number of pixels will always be cropped.
        * If StochasticParameter, then that parameter will be used for each
          image. Four samples will be drawn per image (top, right, bottom,
          left).
        * If a tuple of two ints with values ``a`` and ``b``, then each
          side will be cropped by a random amount in the range
          ``a <= x <= b``. ``x`` is sampled per image side.
        * If a tuple of four entries, then the entries represent top, right,
          bottom, left. Each entry may be a single integer (always crop by
          exactly that value), a tuple of two ints ``a`` and ``b`` (crop by
          an amount ``a <= x <= b``), a list of ints (crop by a random
          value that is contained in the list) or a StochasticParameter
          (sample the amount to crop from that parameter).

percent : None or int or float or imgaug.parameters.StochasticParameter \
          or tuple, optional
    The number of pixels to crop away (cut off) on each side of the image
    given *in percent* of the image height/width.
    E.g. if this is set to 0.1, the augmenter will always crop away
    10 percent of the image's height at the top, 10 percent of the width
    on the right, 10 percent of the height at the bottom and 10 percent
    of the width on the left.
    Either this or the parameter `px` may be set, not both at the same time.

        * If None, then percent-based cropping will not be used.
        * If int, then expected to be 0 (no cropping).
        * If float, then that percentage will always be cropped away.
        * If StochasticParameter, then that parameter will be used for each
          image. Four samples will be drawn per image (top, right, bottom,
          left).
        * If a tuple of two floats with values ``a`` and ``b``, then each
          side will be cropped by a random percentage in the range
          ``a <= x <= b``. ``x`` is sampled per image side.
        * If a tuple of four entries, then the entries represent top, right,
          bottom, left. Each entry may be a single float (always crop by
          exactly that percent value), a tuple of two floats a and ``b``
          (crop by a percentage ``a <= x <= b``), a list of floats (crop by
          a random value that is contained in the list) or a
          StochasticParameter (sample the percentage to crop from that
          parameter).

keep_size : bool, optional
    After cropping, the result image has a different height/width than
    the input image. If this parameter is set to True, then the cropped
    image will be resized to the input image's size, i.e. the image size
    is then not changed by the augmenter.

sample_independently : bool, optional
    If False AND the values for `px`/`percent` result in exactly one
    probability distribution for the amount to crop, only one
    single value will be sampled from that probability distribution
    and used for all sides. I.e. the crop amount then is the same
    for all sides.

name : None or str, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

deterministic : bool, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

random_state : None or int or numpy.random.RandomState, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

Examples
--------
>>> aug = iaa.Crop(px=(0, 10))

crops each side by a random value from the range 0px to 10px (the value
is sampled per side).

>>> aug = iaa.Crop(px=(0, 10), sample_independently=False)

samples one value ``v`` from the discrete range ``[0..10]`` and crops all
sides by ``v`` pixels.

>>> aug = iaa.Crop(px=(0, 10), keep_size=False)

crops each side by a random value from the range 0px to 10px (the value
is sampled per side). After cropping, the images are NOT resized to their
original size (i.e. the images may end up having different heights/widths).

>>> aug = iaa.Crop(px=((0, 10), (0, 5), (0, 10), (0, 5)))

crops the top and bottom by a random value from the range 0px to 10px
and the left and right by a random value in the range 0px to 5px.

>>> aug = iaa.Crop(percent=(0, 0.1))

crops each side by a random value from the range 0 percent to
10 percent. (Percent with respect to the side's size, e.g. for the
top side it uses the image's height.)

>>> aug = iaa.Crop(percent=([0.05, 0.1], [0.05, 0.1], [0.05, 0.1], [0.05, 0.1]))

crops each side by either 5 percent or 10 percent.


def OneOf(children, name=None, deterministic=False, random_state=None):

return SomeOf(n=<NUM_LIT:1>, children=children, random_order=False, name=name, deterministic=deterministic,<EOL>random_state=random_state)<EOL>

Augmenter that always executes exactly one of its children.

dtype support::

    See ``imgaug.augmenters.meta.SomeOf``.

Parameters
----------
children : list of imgaug.augmenters.meta.Augmenter
    The choices of augmenters to apply.

name : None or str, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

deterministic : bool, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

random_state : None or int or numpy.random.RandomState, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

Examples
--------
>>> imgs = [np.ones((10, 10))]
>>> seq = iaa.OneOf([
>>>     iaa.Fliplr(1.0),
>>>     iaa.Flipud(1.0)
>>> ])
>>> imgs_aug = seq.augment_images(imgs)

flips each image either horizontally or vertically.

>>> seq = iaa.OneOf([
>>>     iaa.Fliplr(1.0),
>>>     iaa.Sequential([
>>>         iaa.GaussianBlur(1.0),
>>>         iaa.Dropout(0.05),
>>>         iaa.AdditiveGaussianNoise(0.1*255)
>>>     ]),
>>>     iaa.Noop()
>>> ])
>>> imgs_aug = seq.augment_images(imgs)

either flips each image horizontally, or adds blur+dropout+noise or does
nothing.


def AssertLambda(func_images=None, func_heatmaps=None, func_keypoints=None,<EOL>func_polygons=None, name=None, deterministic=False,<EOL>random_state=None):

def func_images_assert(images, random_state, parents, hooks):<EOL><INDENT>ia.do_assert(func_images(images, random_state, parents, hooks),<EOL>"<STR_LIT>")<EOL>return images<EOL><DEDENT>def func_heatmaps_assert(heatmaps, random_state, parents, hooks):<EOL><INDENT>ia.do_assert(func_heatmaps(heatmaps, random_state, parents, hooks),<EOL>"<STR_LIT>")<EOL>return heatmaps<EOL><DEDENT>def func_keypoints_assert(keypoints_on_images, random_state, parents, hooks):<EOL><INDENT>ia.do_assert(func_keypoints(keypoints_on_images, random_state, parents, hooks),<EOL>"<STR_LIT>")<EOL>return keypoints_on_images<EOL><DEDENT>def func_polygons_assert(polygons_on_images, random_state, parents, hooks):<EOL><INDENT>ia.do_assert(func_polygons(polygons_on_images, random_state, parents, hooks),<EOL>"<STR_LIT>")<EOL>return polygons_on_images<EOL><DEDENT>if name is None:<EOL><INDENT>name = "<STR_LIT>" % (ia.caller_name(),)<EOL><DEDENT>return Lambda(func_images_assert if func_images is not None else None,<EOL>func_heatmaps_assert if func_heatmaps is not None else None,<EOL>func_keypoints_assert if func_keypoints is not None else None,<EOL>func_polygons_assert if func_polygons is not None else None,<EOL>name=name, deterministic=deterministic, random_state=random_state)<EOL>

Augmenter that runs an assert on each batch of input images
using a lambda function as condition.

This is useful to make generic assumption about the input images and error
out early if they aren't met.

dtype support::

    * ``uint8``: yes; fully tested
    * ``uint16``: yes; tested
    * ``uint32``: yes; tested
    * ``uint64``: yes; tested
    * ``int8``: yes; tested
    * ``int16``: yes; tested
    * ``int32``: yes; tested
    * ``int64``: yes; tested
    * ``float16``: yes; tested
    * ``float32``: yes; tested
    * ``float64``: yes; tested
    * ``float128``: yes; tested
    * ``bool``: yes; tested

Parameters
----------
func_images : None or callable, optional
    The function to call for each batch of images.
    It must follow the form ``function(images, random_state, parents, hooks)``
    and return either True (valid input) or False (invalid input).
    It essentially reuses the interface of
    :func:`imgaug.augmenters.meta.Augmenter._augment_images`.

func_heatmaps : None or callable, optional
    The function to call for each batch of heatmaps.
    It must follow the form ``function(heatmaps, random_state, parents, hooks)``
    and return either True (valid input) or False (invalid input).
    It essentially reuses the interface of
    :func:`imgaug.augmenters.meta.Augmenter._augment_heatmaps`.

func_keypoints : None or callable, optional
    The function to call for each batch of keypoints.
    It must follow the form ``function(keypoints_on_images, random_state, parents, hooks)``
    and return either True (valid input) or False (invalid input).
    It essentially reuses the interface of
    :func:`imgaug.augmenters.meta.Augmenter._augment_keypoints`.

func_polygons : None or callable, optional
    The function to call for each batch of polygons.
    It must follow the form ``function(polygons_on_images, random_state, parents, hooks)``
    and return either True (valid input) or False (invalid input).
    It essentially reuses the interface of
    :func:`imgaug.augmenters.meta.Augmenter._augment_polygons`.

name : None or str, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

deterministic : bool, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

random_state : None or int or numpy.random.RandomState, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.


def AssertShape(shape, check_images=True, check_heatmaps=True,<EOL>check_keypoints=True, check_polygons=True,<EOL>name=None, deterministic=False, random_state=None):

ia.do_assert(len(shape) == <NUM_LIT:4>, "<STR_LIT>" % (len(shape), str(shape)))<EOL>def compare(observed, expected, dimension, image_index):<EOL><INDENT>if expected is not None:<EOL><INDENT>if ia.is_single_integer(expected):<EOL><INDENT>ia.do_assert(observed == expected,<EOL>"<STR_LIT>" % (<EOL>dimension, image_index, expected, observed))<EOL><DEDENT>elif isinstance(expected, tuple):<EOL><INDENT>ia.do_assert(len(expected) == <NUM_LIT:2>)<EOL>ia.do_assert(expected[<NUM_LIT:0>] <= observed < expected[<NUM_LIT:1>],<EOL>"<STR_LIT>" % (<EOL>dimension, image_index, expected[<NUM_LIT:0>], expected[<NUM_LIT:1>], observed))<EOL><DEDENT>elif isinstance(expected, list):<EOL><INDENT>ia.do_assert(any([observed == val for val in expected]),<EOL>"<STR_LIT>" % (<EOL>dimension, image_index, str(expected), observed))<EOL><DEDENT>else:<EOL><INDENT>raise Exception(("<STR_LIT>"<EOL>+ "<STR_LIT>") % (dimension, type(expected),))<EOL><DEDENT><DEDENT><DEDENT>def func_images(images, _random_state, _parents, _hooks):<EOL><INDENT>if check_images:<EOL><INDENT>if isinstance(images, list):<EOL><INDENT>if shape[<NUM_LIT:0>] is not None:<EOL><INDENT>compare(len(images), shape[<NUM_LIT:0>], <NUM_LIT:0>, "<STR_LIT>")<EOL><DEDENT>for i in sm.xrange(len(images)):<EOL><INDENT>image = images[i]<EOL>ia.do_assert(len(image.shape) == <NUM_LIT:3>,<EOL>"<STR_LIT>" % (<EOL>i, len(image.shape), str(image.shape)))<EOL>for j in sm.xrange(len(shape)-<NUM_LIT:1>):<EOL><INDENT>expected = shape[j+<NUM_LIT:1>]<EOL>observed = image.shape[j]<EOL>compare(observed, expected, j, i)<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>ia.do_assert(len(images.shape) == <NUM_LIT:4>,<EOL>"<STR_LIT>" % (<EOL>len(images.shape), str(images.shape)))<EOL>for i in range(<NUM_LIT:4>):<EOL><INDENT>expected = shape[i]<EOL>observed = images.shape[i]<EOL>compare(observed, expected, i, "<STR_LIT>")<EOL><DEDENT><DEDENT><DEDENT>return images<EOL><DEDENT>def func_heatmaps(heatmaps, _random_state, _parents, _hooks):<EOL><INDENT>if check_heatmaps:<EOL><INDENT>if shape[<NUM_LIT:0>] is not None:<EOL><INDENT>compare(len(heatmaps), shape[<NUM_LIT:0>], <NUM_LIT:0>, "<STR_LIT>")<EOL><DEDENT>for i in sm.xrange(len(heatmaps)):<EOL><INDENT>heatmaps_i = heatmaps[i]<EOL>for j in sm.xrange(len(shape[<NUM_LIT:0>:<NUM_LIT:2>])):<EOL><INDENT>expected = shape[j+<NUM_LIT:1>]<EOL>observed = heatmaps_i.arr_0to1.shape[j]<EOL>compare(observed, expected, j, i)<EOL><DEDENT><DEDENT><DEDENT>return heatmaps<EOL><DEDENT>def func_keypoints(keypoints_on_images, _random_state, _parents, _hooks):<EOL><INDENT>if check_keypoints:<EOL><INDENT>if shape[<NUM_LIT:0>] is not None:<EOL><INDENT>compare(len(keypoints_on_images), shape[<NUM_LIT:0>], <NUM_LIT:0>, "<STR_LIT>")<EOL><DEDENT>for i in sm.xrange(len(keypoints_on_images)):<EOL><INDENT>keypoints_on_image = keypoints_on_images[i]<EOL>for j in sm.xrange(len(shape[<NUM_LIT:0>:<NUM_LIT:2>])):<EOL><INDENT>expected = shape[j+<NUM_LIT:1>]<EOL>observed = keypoints_on_image.shape[j]<EOL>compare(observed, expected, j, i)<EOL><DEDENT><DEDENT><DEDENT>return keypoints_on_images<EOL><DEDENT>def func_polygons(polygons_on_images, _random_state, _parents, _hooks):<EOL><INDENT>if check_polygons:<EOL><INDENT>if shape[<NUM_LIT:0>] is not None:<EOL><INDENT>compare(len(polygons_on_images), shape[<NUM_LIT:0>], <NUM_LIT:0>, "<STR_LIT>")<EOL><DEDENT>for i in sm.xrange(len(polygons_on_images)):<EOL><INDENT>polygons_on_image = polygons_on_images[i]<EOL>for j in sm.xrange(len(shape[<NUM_LIT:0>:<NUM_LIT:2>])):<EOL><INDENT>expected = shape[j+<NUM_LIT:1>]<EOL>observed = polygons_on_image.shape[j]<EOL>compare(observed, expected, j, i)<EOL><DEDENT><DEDENT><DEDENT>return polygons_on_images<EOL><DEDENT>if name is None:<EOL><INDENT>name = "<STR_LIT>" % (ia.caller_name(),)<EOL><DEDENT>return Lambda(func_images, func_heatmaps, func_keypoints, func_polygons,<EOL>name=name, deterministic=deterministic,<EOL>random_state=random_state)<EOL>

Augmenter to make assumptions about the shape of input image(s), heatmaps and keypoints.

dtype support::

    * ``uint8``: yes; fully tested
    * ``uint16``: yes; tested
    * ``uint32``: yes; tested
    * ``uint64``: yes; tested
    * ``int8``: yes; tested
    * ``int16``: yes; tested
    * ``int32``: yes; tested
    * ``int64``: yes; tested
    * ``float16``: yes; tested
    * ``float32``: yes; tested
    * ``float64``: yes; tested
    * ``float128``: yes; tested
    * ``bool``: yes; tested

Parameters
----------
shape : tuple
    The expected shape, given as a tuple. The number of entries in the tuple must match the
    number of dimensions, i.e. it must contain four entries for ``(N, H, W, C)``. If only a
    single image is augmented via ``augment_image()``, then ``N`` is viewed as 1 by this
    augmenter. If the input image(s) don't have a channel axis, then ``C`` is viewed as 1
    by this augmenter.
    Each of the four entries may be None or a tuple of two ints or a list of ints.

        * If an entry is None, any value for that dimensions is accepted.
        * If an entry is int, exactly that integer value will be accepted
          or no other value.
        * If an entry is a tuple of two ints with values ``a`` and ``b``, only a
          value ``x`` with ``a <= x < b`` will be accepted for the dimension.
        * If an entry is a list of ints, only a value for the dimension
          will be accepted which is contained in the list.

check_images : bool, optional
    Whether to validate input images via the given shape.

check_heatmaps : bool, optional
    Whether to validate input heatmaps via the given shape.
    The number of heatmaps will be checked and for each Heatmaps
    instance its array's height and width, but not the channel
    count as the channel number denotes the expected number of channels
    in images.

check_keypoints : bool, optional
    Whether to validate input keypoints via the given shape.
    This will check (a) the number of keypoints and (b) for each
    KeypointsOnImage instance the ``.shape``, i.e. the shape of the
    corresponding image.

check_polygons : bool, optional
    Whether to validate input keypoints via the given shape.
    This will check (a) the number of polygons and (b) for each
    PolygonsOnImage instance the ``.shape``, i.e. the shape of the
    corresponding image.

name : None or str, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

deterministic : bool, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

random_state : None or int or numpy.random.RandomState, optional
    See :func:`imgaug.augmenters.meta.Augmenter.__init__`.

Examples
--------
>>> seq = iaa.Sequential([
>>>     iaa.AssertShape((None, 32, 32, 3)),
>>>     iaa.Fliplr(0.5)
>>> ])

will first check for each image batch, if it contains a variable number of
``32x32`` images with 3 channels each. Only if that check succeeds, the
horizontal flip will be executed (otherwise an assertion error will be
thrown).

>>> seq = iaa.Sequential([
>>>     iaa.AssertShape((None, (32, 64), 32, [1, 3])),
>>>     iaa.Fliplr(0.5)
>>> ])

like above, but now the height may be in the range ``32 <= H < 64`` and
the number of channels may be either 1 or 3.


def shuffle_channels(image, random_state, channels=None):

if image.ndim < <NUM_LIT:3> or image.shape[<NUM_LIT:2>] == <NUM_LIT:1>:<EOL><INDENT>return image<EOL><DEDENT>nb_channels = image.shape[<NUM_LIT:2>]<EOL>all_channels = np.arange(nb_channels)<EOL>is_all_channels = (<EOL>channels is None<EOL>or channels == ia.ALL<EOL>or len(set(all_channels).difference(set(channels))) == <NUM_LIT:0><EOL>)<EOL>if is_all_channels:<EOL><INDENT>channels_perm = random_state.permutation(all_channels)<EOL>return image[..., channels_perm]<EOL><DEDENT>else:<EOL><INDENT>channels_perm = random_state.permutation(channels)<EOL>channels_perm_full = all_channels<EOL>for channel_source, channel_target in zip(channels, channels_perm):<EOL><INDENT>channels_perm_full[channel_source] = channel_target<EOL><DEDENT>return image[..., channels_perm_full]<EOL><DEDENT>

Randomize the order of (color) channels in an image.

dtype support::

    * ``uint8``: yes; fully tested
    * ``uint16``: yes; indirectly tested (1)
    * ``uint32``: yes; indirectly tested (1)
    * ``uint64``: yes; indirectly tested (1)
    * ``int8``: yes; indirectly tested (1)
    * ``int16``: yes; indirectly tested (1)
    * ``int32``: yes; indirectly tested (1)
    * ``int64``: yes; indirectly tested (1)
    * ``float16``: yes; indirectly tested (1)
    * ``float32``: yes; indirectly tested (1)
    * ``float64``: yes; indirectly tested (1)
    * ``float128``: yes; indirectly tested (1)
    * ``bool``: yes; indirectly tested (1)

    - (1) Indirectly tested via ``ChannelShuffle``.

Parameters
----------
image : (H,W,[C]) ndarray
    Image of any dtype for which to shuffle the channels.

random_state : numpy.random.RandomState
    The random state to use for this shuffling operation.

channels : None or imgaug.ALL or list of int, optional
    Which channels are allowed to be shuffled with each other.
    If this is ``None`` or ``imgaug.ALL``, then all channels may be shuffled. If it is a list of integers,
    then only the channels with indices in that list may be shuffled. (Values start at 0. All channel indices in
    the list must exist in each image.)

Returns
-------
ndarray
    The input image with shuffled channels.


def __init__(self, name=None, deterministic=False, random_state=None):

super(Augmenter, self).__init__()<EOL>ia.do_assert(name is None or ia.is_string(name),<EOL>"<STR_LIT>" % (type(name),))<EOL>if name is None:<EOL><INDENT>self.name = "<STR_LIT>" % (self.__class__.__name__,)<EOL><DEDENT>else:<EOL><INDENT>self.name = name<EOL><DEDENT>ia.do_assert(ia.is_single_bool(deterministic),<EOL>"<STR_LIT>" % (type(deterministic),))<EOL>self.deterministic = deterministic<EOL>if random_state is None:<EOL><INDENT>if self.deterministic:<EOL><INDENT>self.random_state = ia.new_random_state()<EOL><DEDENT>else:<EOL><INDENT>self.random_state = ia.current_random_state()<EOL><DEDENT><DEDENT>elif isinstance(random_state, np.random.RandomState):<EOL><INDENT>self.random_state = random_state<EOL><DEDENT>else:<EOL><INDENT>self.random_state = np.random.RandomState(random_state)<EOL><DEDENT>self.activated = True<EOL>

Create a new Augmenter instance.

Parameters
----------
name : None or str, optional
    Name given to an Augmenter object. This name is used in ``print()``
    statements as well as find and remove functions.
    If None, ``UnnamedX`` will be used as the name, where ``X`` is the
    Augmenter's class name.

deterministic : bool, optional
    Whether the augmenter instance's random state will be saved before
    augmenting images and then reset to that saved state after an
    augmentation (of multiple images/keypoints) is finished.
    I.e. if set to True, each batch of images will be augmented in the
    same way (e.g. first image might always be flipped horizontally,
    second image will never be flipped etc.).
    This is useful when you want to transform multiple batches of images
    in the same way, or when you want to augment images and keypoints
    on these images.
    Usually, there is no need to set this variable by hand. Instead,
    instantiate the augmenter with the defaults and then use
    :func:`imgaug.augmenters.Augmenter.to_deterministic`.

random_state : None or int or numpy.random.RandomState, optional
    The random state to use for this augmenter.

        * If int, a new ``numpy.random.RandomState`` will be created using this
          value as the seed.
        * If ``numpy.random.RandomState`` instance, the instance will be used directly.
        * If None, imgaug's default RandomState will be used, which's state can
          be controlled using ``imgaug.seed(int)``.

    Usually there is no need to set this variable by hand. Instead,
    instantiate the augmenter with the defaults and then use
    :func:`imgaug.augmenters.Augmenter.to_deterministic`.


def augment_batches(self, batches, hooks=None, background=False):

if isinstance(batches, (Batch, UnnormalizedBatch)):<EOL><INDENT>batches = [batches]<EOL><DEDENT>ia.do_assert(<EOL>(ia.is_iterable(batches)<EOL>and not ia.is_np_array(batches)<EOL>and not ia.is_string(batches))<EOL>or ia.is_generator(batches),<EOL>("<STR_LIT>"<EOL>+ "<STR_LIT>") % (type(batches),))<EOL>if background:<EOL><INDENT>ia.do_assert(<EOL>hooks is None,<EOL>"<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>def _normalize_batch(idx, batch):<EOL><INDENT>if isinstance(batch, Batch):<EOL><INDENT>batch_copy = batch.deepcopy()<EOL>batch_copy.data = (idx, batch_copy.data)<EOL>batch_normalized = batch_copy<EOL>batch_orig_dt = "<STR_LIT>"<EOL><DEDENT>elif isinstance(batch, UnnormalizedBatch):<EOL><INDENT>batch_copy = batch.to_normalized_batch()<EOL>batch_copy.data = (idx, batch_copy.data)<EOL>batch_normalized = batch_copy<EOL>batch_orig_dt = "<STR_LIT>"<EOL><DEDENT>elif ia.is_np_array(batch):<EOL><INDENT>ia.do_assert(<EOL>batch.ndim in (<NUM_LIT:3>, <NUM_LIT:4>),<EOL>("<STR_LIT>"<EOL>+ "<STR_LIT>") % (batch.shape,))<EOL>batch_normalized = Batch(images=batch, data=(idx,))<EOL>batch_orig_dt = "<STR_LIT>"<EOL><DEDENT>elif isinstance(batch, list):<EOL><INDENT>if len(batch) == <NUM_LIT:0>:<EOL><INDENT>batch_normalized = Batch(data=(idx,))<EOL>batch_orig_dt = "<STR_LIT>"<EOL><DEDENT>elif ia.is_np_array(batch[<NUM_LIT:0>]):<EOL><INDENT>batch_normalized = Batch(images=batch, data=(idx,))<EOL>batch_orig_dt = "<STR_LIT>"<EOL><DEDENT>elif isinstance(batch[<NUM_LIT:0>], ia.HeatmapsOnImage):<EOL><INDENT>batch_normalized = Batch(heatmaps=batch, data=(idx,))<EOL>batch_orig_dt = "<STR_LIT>"<EOL><DEDENT>elif isinstance(batch[<NUM_LIT:0>], ia.SegmentationMapOnImage):<EOL><INDENT>batch_normalized = Batch(segmentation_maps=batch,<EOL>data=(idx,))<EOL>batch_orig_dt = "<STR_LIT>"<EOL><DEDENT>elif isinstance(batch[<NUM_LIT:0>], ia.KeypointsOnImage):<EOL><INDENT>batch_normalized = Batch(keypoints=batch, data=(idx,))<EOL>batch_orig_dt = "<STR_LIT>"<EOL><DEDENT>elif isinstance(batch[<NUM_LIT:0>], ia.BoundingBoxesOnImage):<EOL><INDENT>batch_normalized = Batch(bounding_boxes=batch, data=(idx,))<EOL>batch_orig_dt = "<STR_LIT>"<EOL><DEDENT>elif isinstance(batch[<NUM_LIT:0>], ia.PolygonsOnImage):<EOL><INDENT>batch_normalized = Batch(polygons=batch, data=(idx,))<EOL>batch_orig_dt = "<STR_LIT>"<EOL><DEDENT>else:<EOL><INDENT>raise Exception(<EOL>("<STR_LIT>"<EOL>+ "<STR_LIT>"<EOL>+ "<STR_LIT>"<EOL>+ "<STR_LIT>"<EOL>+ "<STR_LIT>"<EOL>+ "<STR_LIT>"<EOL>+ "<STR_LIT>") % (type(batch[<NUM_LIT:0>]),))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>raise Exception(<EOL>("<STR_LIT>"<EOL>+ "<STR_LIT>"<EOL>+ "<STR_LIT>"<EOL>+ "<STR_LIT>"<EOL>+ "<STR_LIT>"<EOL>+ "<STR_LIT>"<EOL>+ "<STR_LIT>"<EOL>+ "<STR_LIT>") % (type(batch),))<EOL><DEDENT>if batch_orig_dt not in ["<STR_LIT>",<EOL>"<STR_LIT>"]:<EOL><INDENT>ia.warn_deprecated(<EOL>("<STR_LIT>"<EOL>+ "<STR_LIT>"<EOL>+ "<STR_LIT>"<EOL>+ "<STR_LIT>"<EOL>+ "<STR_LIT>") % (<EOL>batch_orig_dt,))<EOL><DEDENT>return batch_normalized, batch_orig_dt<EOL><DEDENT>def _unnormalize_batch(batch_aug, batch_orig, batch_orig_dt):<EOL><INDENT>if batch_orig_dt == "<STR_LIT>":<EOL><INDENT>batch_unnormalized = batch_aug<EOL>batch_unnormalized.data = batch_unnormalized.data[<NUM_LIT:1>]<EOL><DEDENT>elif batch_orig_dt == "<STR_LIT>":<EOL><INDENT>batch_aug.data = batch_aug.data[<NUM_LIT:1>]<EOL>batch_unnormalized =batch_orig.fill_from_augmented_normalized_batch(batch_aug)<EOL><DEDENT>elif batch_orig_dt == "<STR_LIT>":<EOL><INDENT>batch_unnormalized = batch_aug.images_aug<EOL><DEDENT>elif batch_orig_dt == "<STR_LIT>":<EOL><INDENT>batch_unnormalized = []<EOL><DEDENT>elif batch_orig_dt == "<STR_LIT>":<EOL><INDENT>batch_unnormalized = batch_aug.images_aug<EOL><DEDENT>elif batch_orig_dt == "<STR_LIT>":<EOL><INDENT>batch_unnormalized = batch_aug.heatmaps_aug<EOL><DEDENT>elif batch_orig_dt == "<STR_LIT>":<EOL><INDENT>batch_unnormalized = batch_aug.segmentation_maps_aug<EOL><DEDENT>elif batch_orig_dt == "<STR_LIT>":<EOL><INDENT>batch_unnormalized = batch_aug.keypoints_aug<EOL><DEDENT>elif batch_orig_dt == "<STR_LIT>":<EOL><INDENT>batch_unnormalized = batch_aug.bounding_boxes_aug<EOL><DEDENT>else:  <EOL><INDENT>ia.do_assert(batch_orig_dt == "<STR_LIT>")<EOL>batch_unnormalized = batch_aug.polygons_aug<EOL><DEDENT>return batch_unnormalized<EOL><DEDENT>if not background:<EOL><INDENT>for idx, batch in enumerate(batches):<EOL><INDENT>batch_normalized, batch_orig_dt = _normalize_batch(idx, batch)<EOL>batch_normalized = self.augment_batch(<EOL>batch_normalized, hooks=hooks)<EOL>batch_unnormalized = _unnormalize_batch(<EOL>batch_normalized, batch, batch_orig_dt)<EOL>yield batch_unnormalized<EOL><DEDENT><DEDENT>else:<EOL><INDENT>import imgaug.multicore as multicore<EOL>id_to_batch_orig = dict()<EOL>def load_batches():<EOL><INDENT>for idx, batch in enumerate(batches):<EOL><INDENT>batch_normalized, batch_orig_dt = _normalize_batch(<EOL>idx, batch)<EOL>id_to_batch_orig[idx] = (batch, batch_orig_dt)<EOL>yield batch_normalized<EOL><DEDENT><DEDENT>with multicore.Pool(self) as pool:<EOL><INDENT>for batch_aug in pool.imap_batches(load_batches()):<EOL><INDENT>idx = batch_aug.data[<NUM_LIT:0>]<EOL>assert idx in id_to_batch_orig<EOL>batch_orig, batch_orig_dt = id_to_batch_orig[idx]<EOL>batch_unnormalized = _unnormalize_batch(<EOL>batch_aug, batch_orig, batch_orig_dt)<EOL>del id_to_batch_orig[idx]<EOL>yield batch_unnormalized<EOL><DEDENT><DEDENT><DEDENT>

Augment multiple batches.

In contrast to other augment functions, this function _yields_ batches
instead of just returning a full list. This is more suited for most
training loops. It also supports augmentation on multiple cpu cores,
activated via the `background` flag.

Parameters
----------
batches : imgaug.augmentables.batches.Batch \
          or imgaug.augmentables.batches.UnnormalizedBatch \
          or iterable of imgaug.augmentables.batches.Batch \
          or iterable of imgaug.augmentables.batches.UnnormalizedBatch
    A single batch or a list of batches to augment.

hooks : None or imgaug.HooksImages, optional
    HooksImages object to dynamically interfere with the augmentation
    process.

background : bool, optional
    Whether to augment the batches in background processes.
    If true, hooks can currently not be used as that would require
    pickling functions.
    Note that multicore augmentation distributes the batches onto
    different CPU cores. It does not split the data within batches.
    It is therefore not sensible to use ``background=True`` for a
    single batch.
    Note also that multicore augmentation needs some time to start. It
    is therefore not recommended to use it for very few batches.

Yields
-------
imgaug.augmentables.batches.Batch \
          or imgaug.augmentables.batches.UnnormalizedBatch \
          or iterable of imgaug.augmentables.batches.Batch \
          or iterable of imgaug.augmentables.batches.UnnormalizedBatch
    Augmented batches.


def augment_batch(self, batch, hooks=None):

batch_orig = batch<EOL>if isinstance(batch, UnnormalizedBatch):<EOL><INDENT>batch = batch.to_normalized_batch()<EOL><DEDENT>augmentables = [(attr_name[:-len("<STR_LIT>")], attr)<EOL>for attr_name, attr<EOL>in batch.__dict__.items()<EOL>if attr_name.endswith("<STR_LIT>") and attr is not None]<EOL>augseq = self<EOL>if len(augmentables) > <NUM_LIT:1> and not self.deterministic:<EOL><INDENT>augseq = self.to_deterministic()<EOL><DEDENT>for attr_name, attr in augmentables:<EOL><INDENT>aug = getattr(augseq, "<STR_LIT>" % (attr_name,))(<EOL>attr, hooks=hooks)<EOL>setattr(batch, "<STR_LIT>" % (attr_name,), aug)<EOL><DEDENT>if isinstance(batch_orig, UnnormalizedBatch):<EOL><INDENT>batch = batch_orig.fill_from_augmented_normalized_batch(batch)<EOL><DEDENT>return batch<EOL>

Augment a single batch.

Parameters
----------
batch : imgaug.augmentables.batches.Batch \
        or imgaug.augmentables.batches.UnnormalizedBatch
    A single batch to augment.

hooks : None or imgaug.HooksImages, optional
    HooksImages object to dynamically interfere with the augmentation
    process.

Returns
-------
imgaug.augmentables.batches.Batch \
        or imgaug.augmentables.batches.UnnormalizedBatch
    Augmented batch.


def augment_image(self, image, hooks=None):

ia.do_assert(image.ndim in [<NUM_LIT:2>, <NUM_LIT:3>],<EOL>"<STR_LIT>" % (image.shape,))<EOL>return self.augment_images([image], hooks=hooks)[<NUM_LIT:0>]<EOL>

Augment a single image.

Parameters
----------
image : (H,W,C) ndarray or (H,W) ndarray
    The image to augment.
    Channel-axis is optional, but expected to be the last axis if present.
    In most cases, this array should be of dtype ``uint8``, which is supported by all
    augmenters. Support for other dtypes varies by augmenter -- see the respective
    augmenter-specific documentation for more details.

hooks : None or imgaug.HooksImages, optional
    HooksImages object to dynamically interfere with the augmentation process.

Returns
-------
img : ndarray
    The corresponding augmented image.


def augment_images(self, images, parents=None, hooks=None):

if parents is not None and len(parents) > <NUM_LIT:0> and hooks is None:<EOL><INDENT>if not self.activated or len(images) == <NUM_LIT:0>:<EOL><INDENT>return images<EOL><DEDENT>if self.deterministic:<EOL><INDENT>state_orig = self.random_state.get_state()<EOL><DEDENT>images_result = self._augment_images(<EOL>images,<EOL>random_state=ia.copy_random_state(self.random_state),<EOL>parents=parents,<EOL>hooks=hooks<EOL>)<EOL>ia.forward_random_state(self.random_state)<EOL>if self.deterministic:<EOL><INDENT>self.random_state.set_state(state_orig)<EOL><DEDENT>return images_result<EOL><DEDENT>if self.deterministic:<EOL><INDENT>state_orig = self.random_state.get_state()<EOL><DEDENT>if parents is None:<EOL><INDENT>parents = []<EOL><DEDENT>if ia.is_np_array(images):<EOL><INDENT>input_type = "<STR_LIT>"<EOL>input_added_axis = False<EOL>ia.do_assert(images.ndim in [<NUM_LIT:3>, <NUM_LIT:4>],<EOL>"<STR_LIT>"<EOL>"<STR_LIT>" % (images.shape,))<EOL>images_copy = np.copy(images)<EOL>if images_copy.ndim == <NUM_LIT:3> and images_copy.shape[-<NUM_LIT:1>] in [<NUM_LIT:1>, <NUM_LIT:3>]:<EOL><INDENT>warnings.warn("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>" % (images_copy.shape,))<EOL><DEDENT>if images_copy.ndim == <NUM_LIT:3>:<EOL><INDENT>images_copy = images_copy[..., np.newaxis]<EOL>input_added_axis = True<EOL><DEDENT><DEDENT>elif ia.is_iterable(images):<EOL><INDENT>input_type = "<STR_LIT:list>"<EOL>input_added_axis = []<EOL>if len(images) == <NUM_LIT:0>:<EOL><INDENT>images_copy = []<EOL><DEDENT>else:<EOL><INDENT>ia.do_assert(all(image.ndim in [<NUM_LIT:2>, <NUM_LIT:3>] for image in images),<EOL>"<STR_LIT>"<EOL>+ "<STR_LIT>" % ([image.shape for image in images],))<EOL>images_copy = []<EOL>input_added_axis = []<EOL>for image in images:<EOL><INDENT>image_copy = np.copy(image)<EOL>if image.ndim == <NUM_LIT:2>:<EOL><INDENT>image_copy = image_copy[:, :, np.newaxis]<EOL>input_added_axis.append(True)<EOL><DEDENT>else:<EOL><INDENT>input_added_axis.append(False)<EOL><DEDENT>images_copy.append(image_copy)<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>raise Exception("<STR_LIT>" % (<EOL>type(images),))<EOL><DEDENT>if hooks is not None:<EOL><INDENT>images_copy = hooks.preprocess(images_copy, augmenter=self, parents=parents)<EOL><DEDENT>if (hooks is None and self.activated)or (hooks is not None<EOL>and hooks.is_activated(images_copy, augmenter=self, parents=parents, default=self.activated)):<EOL><INDENT>if len(images) > <NUM_LIT:0>:<EOL><INDENT>images_result = self._augment_images(<EOL>images_copy,<EOL>random_state=ia.copy_random_state(self.random_state),<EOL>parents=parents,<EOL>hooks=hooks<EOL>)<EOL>ia.forward_random_state(self.random_state)<EOL><DEDENT>else:<EOL><INDENT>images_result = images_copy<EOL><DEDENT><DEDENT>else:<EOL><INDENT>images_result = images_copy<EOL><DEDENT>if hooks is not None:<EOL><INDENT>images_result = hooks.postprocess(images_result, augmenter=self, parents=parents)<EOL><DEDENT>output_type = "<STR_LIT:list>" if isinstance(images_result, list) else "<STR_LIT>"<EOL>if input_type == "<STR_LIT>":<EOL><INDENT>if input_added_axis is True:<EOL><INDENT>if output_type == "<STR_LIT>":<EOL><INDENT>images_result = np.squeeze(images_result, axis=<NUM_LIT:3>)<EOL><DEDENT>else:<EOL><INDENT>images_result = [np.squeeze(image, axis=<NUM_LIT:2>) for image in images_result]<EOL><DEDENT><DEDENT><DEDENT>else:  <EOL><INDENT>ia.do_assert(<EOL>len(images_result) == len(images),<EOL>"<STR_LIT>"<EOL>"<STR_LIT>" % (len(images), len(images_result))<EOL>)<EOL>for i in sm.xrange(len(images_result)):<EOL><INDENT>if input_added_axis[i] is True:<EOL><INDENT>images_result[i] = np.squeeze(images_result[i], axis=<NUM_LIT:2>)<EOL><DEDENT><DEDENT><DEDENT>if self.deterministic:<EOL><INDENT>self.random_state.set_state(state_orig)<EOL><DEDENT>return images_result<EOL>

Augment multiple images.

Parameters
----------
images : (N,H,W,C) ndarray or (N,H,W) ndarray or list of (H,W,C) ndarray or list of (H,W) ndarray
    Images to augment.
    The input can be a list of numpy arrays or a single array. Each array is expected to
    have shape ``(H, W, C)`` or ``(H, W)``, where H is the height, ``W`` is the width and
    ``C`` are the channels. Number of channels may differ between images.
    If a list is chosen, height and width may differ per between images.
    In most cases, this array (or these arrays) should be of dtype ``uint8``, which is
    supported by all augmenters. Support for other dtypes varies by augmenter -- see the
    respective augmenter-specific documentation for more details.

parents : None or list of imgaug.augmenters.Augmenter, optional
    Parent augmenters that have previously been called before the
    call to this function. Usually you can leave this parameter as None.
    It is set automatically for child augmenters.

hooks : None or imgaug.HooksImages, optional
    HooksImages object to dynamically interfere with the augmentation process.

Returns
-------
images_result : ndarray or list
    Corresponding augmented images.


@abstractmethod<EOL><INDENT>def _augment_images(self, images, random_state, parents, hooks):<DEDENT>

raise NotImplementedError()<EOL>

Augment multiple images.

This is the internal variation of `augment_images()`.
It is called from `augment_images()` and should usually not be called
directly.
It has to be implemented by every augmenter.
This method may transform the images in-place.
This method does not have to care about determinism or the
Augmenter instance's ``random_state`` variable. The parameter
``random_state`` takes care of both of these.

Parameters
----------
images : (N,H,W,C) ndarray or list of (H,W,C) ndarray
    Images to augment.
    They may be changed in-place.
    Either a list of ``(H, W, C)`` arrays or a single ``(N, H, W, C)`` array,
    where ``N`` is the number of images, ``H`` is the height of images, ``W``
    is the width of images and ``C`` is the number of channels of images.
    In the case of a list as input, ``H``, ``W`` and ``C`` may change per image.

random_state : numpy.random.RandomState
    The random state to use for all sampling tasks during the augmentation.

parents : list of imgaug.augmenters.meta.Augmenter
    See :func:`imgaug.augmenters.meta.Augmenter.augment_images`.

hooks : imgaug.HooksImages or None
    See :func:`imgaug.augmenters.meta.Augmenter.augment_images`.

Returns
----------
images : (N,H,W,C) ndarray or list of (H,W,C) ndarray
    The augmented images.


def augment_heatmaps(self, heatmaps, parents=None, hooks=None):

if self.deterministic:<EOL><INDENT>state_orig = self.random_state.get_state()<EOL><DEDENT>if parents is None:<EOL><INDENT>parents = []<EOL><DEDENT>input_was_single_instance = False<EOL>if isinstance(heatmaps, ia.HeatmapsOnImage):<EOL><INDENT>input_was_single_instance = True<EOL>heatmaps = [heatmaps]<EOL><DEDENT>ia.do_assert(ia.is_iterable(heatmaps),<EOL>"<STR_LIT>" % (type(heatmaps),))<EOL>ia.do_assert(all([isinstance(heatmaps_i, ia.HeatmapsOnImage) for heatmaps_i in heatmaps]),<EOL>"<STR_LIT>" % (<EOL>[type(el) for el in heatmaps],))<EOL>if len(parents) == <NUM_LIT:0> or hooks is not None:<EOL><INDENT>heatmaps_copy = [heatmaps_i.deepcopy() for heatmaps_i in heatmaps]<EOL><DEDENT>else:<EOL><INDENT>heatmaps_copy = heatmaps<EOL><DEDENT>if hooks is not None:<EOL><INDENT>heatmaps_copy = hooks.preprocess(heatmaps_copy, augmenter=self, parents=parents)<EOL><DEDENT>if (hooks is None and self.activated)or (hooks is not None<EOL>and hooks.is_activated(heatmaps_copy, augmenter=self, parents=parents, default=self.activated)):<EOL><INDENT>if len(heatmaps_copy) > <NUM_LIT:0>:<EOL><INDENT>heatmaps_result = self._augment_heatmaps(<EOL>heatmaps_copy,<EOL>random_state=ia.copy_random_state(self.random_state),<EOL>parents=parents,<EOL>hooks=hooks<EOL>)<EOL>ia.forward_random_state(self.random_state)<EOL><DEDENT>else:<EOL><INDENT>heatmaps_result = heatmaps_copy<EOL><DEDENT><DEDENT>else:<EOL><INDENT>heatmaps_result = heatmaps_copy<EOL><DEDENT>if hooks is not None:<EOL><INDENT>heatmaps_result = hooks.postprocess(heatmaps_result, augmenter=self, parents=parents)<EOL><DEDENT>if self.deterministic:<EOL><INDENT>self.random_state.set_state(state_orig)<EOL><DEDENT>if input_was_single_instance:<EOL><INDENT>return heatmaps_result[<NUM_LIT:0>]<EOL><DEDENT>return heatmaps_result<EOL>

Augment a heatmap.

Parameters
----------
heatmaps : imgaug.HeatmapsOnImage or list of imgaug.HeatmapsOnImage
    Heatmap(s) to augment. Either a single heatmap or a list of
    heatmaps.

parents : None or list of imgaug.augmenters.meta.Augmenter, optional
    Parent augmenters that have previously been called before the
    call to this function. Usually you can leave this parameter as None.
    It is set automatically for child augmenters.

hooks : None or imaug.HooksHeatmaps, optional
    HooksHeatmaps object to dynamically interfere with the augmentation process.

Returns
-------
heatmap_result : imgaug.HeatmapsOnImage or list of imgaug.HeatmapsOnImage
    Corresponding augmented heatmap(s).


@abstractmethod<EOL><INDENT>def _augment_heatmaps(self, heatmaps, random_state, parents, hooks):<DEDENT>

raise NotImplementedError()<EOL>

Augment heatmaps on multiple images.

This is the internal version of ``augment_heatmaps()``.
It is called from ``augment_heatmaps()`` and should usually not be called
directly.
This method may heatmaps in-place.
This method does not have to care about determinism or the
Augmenter instance's ``random_state`` variable. The parameter
``random_state`` takes care of both of these.

Parameters
----------
heatmaps : list of imgaug.HeatmapsOnImage
    Heatmaps to augment. They may be changed in-place.

parents : list of imgaug.augmenters.meta.Augmenter
    See :func:`imgaug.augmenters.meta.Augmenter.augment_heatmaps`.

hooks : imgaug.HooksHeatmaps or None
    See :func:`imgaug.augmenters.meta.Augmenter.augment_heatmaps`.

Returns
----------
images : list of imgaug.HeatmapsOnImage
    The augmented heatmaps.


def augment_segmentation_maps(self, segmaps, parents=None, hooks=None):

input_was_single_instance = False<EOL>if isinstance(segmaps, ia.SegmentationMapOnImage):<EOL><INDENT>input_was_single_instance = True<EOL>segmaps = [segmaps]<EOL><DEDENT>heatmaps_with_nonempty = [segmap.to_heatmaps(only_nonempty=True, not_none_if_no_nonempty=True)<EOL>for segmap in segmaps]<EOL>heatmaps = [heatmaps_i for heatmaps_i, nonempty_class_indices_i in heatmaps_with_nonempty]<EOL>nonempty_class_indices = [nonempty_class_indices_i<EOL>for heatmaps_i, nonempty_class_indices_i in heatmaps_with_nonempty]<EOL>heatmaps_aug = self.augment_heatmaps(heatmaps, parents=parents, hooks=hooks)<EOL>segmaps_aug = []<EOL>for segmap, heatmaps_aug_i, nonempty_class_indices_i in zip(segmaps, heatmaps_aug, nonempty_class_indices):<EOL><INDENT>segmap_aug = ia.SegmentationMapOnImage.from_heatmaps(heatmaps_aug_i,<EOL>class_indices=nonempty_class_indices_i,<EOL>nb_classes=segmap.nb_classes)<EOL>segmap_aug.input_was = segmap.input_was<EOL>segmaps_aug.append(segmap_aug)<EOL><DEDENT>if input_was_single_instance:<EOL><INDENT>return segmaps_aug[<NUM_LIT:0>]<EOL><DEDENT>return segmaps_aug<EOL>

Augment segmentation maps.

Parameters
----------
segmaps : imgaug.SegmentationMapOnImage or \
          list of imgaug.SegmentationMapOnImage
    Segmentation map(s) to augment. Either a single heatmap or a list of
    segmentation maps.

parents : None or list of imgaug.augmenters.meta.Augmenter, optional
    Parent augmenters that have previously been called before the
    call to this function. Usually you can leave this parameter as None.
    It is set automatically for child augmenters.

hooks : None or imgaug.HooksHeatmaps, optional
    HooksHeatmaps object to dynamically interfere with the augmentation process.

Returns
-------
segmaps_aug : imgaug.SegmentationMapOnImage or \
              list of imgaug.SegmentationMapOnImage
    Corresponding augmented segmentation map(s).


def augment_keypoints(self, keypoints_on_images, parents=None, hooks=None):

if self.deterministic:<EOL><INDENT>state_orig = self.random_state.get_state()<EOL><DEDENT>if parents is None:<EOL><INDENT>parents = []<EOL><DEDENT>input_was_single_instance = False<EOL>if isinstance(keypoints_on_images, ia.KeypointsOnImage):<EOL><INDENT>input_was_single_instance = True<EOL>keypoints_on_images = [keypoints_on_images]<EOL><DEDENT>ia.do_assert(ia.is_iterable(keypoints_on_images))<EOL>ia.do_assert(all([isinstance(keypoints_on_image, ia.KeypointsOnImage)<EOL>for keypoints_on_image in keypoints_on_images]))<EOL>if len(parents) == <NUM_LIT:0> or hooks is not None:<EOL><INDENT>keypoints_on_images_copy = [keypoints_on_image.deepcopy() for keypoints_on_image in keypoints_on_images]<EOL><DEDENT>else:<EOL><INDENT>keypoints_on_images_copy = keypoints_on_images<EOL><DEDENT>if hooks is not None:<EOL><INDENT>keypoints_on_images_copy = hooks.preprocess(keypoints_on_images_copy, augmenter=self, parents=parents)<EOL><DEDENT>if (hooks is None and self.activated)or (hooks is not None<EOL>and hooks.is_activated(keypoints_on_images_copy,<EOL>augmenter=self, parents=parents, default=self.activated)):<EOL><INDENT>if len(keypoints_on_images_copy) > <NUM_LIT:0>:<EOL><INDENT>keypoints_on_images_result = self._augment_keypoints(<EOL>keypoints_on_images_copy,<EOL>random_state=ia.copy_random_state(self.random_state),<EOL>parents=parents,<EOL>hooks=hooks<EOL>)<EOL>ia.forward_random_state(self.random_state)<EOL><DEDENT>else:<EOL><INDENT>keypoints_on_images_result = keypoints_on_images_copy<EOL><DEDENT><DEDENT>else:<EOL><INDENT>keypoints_on_images_result = keypoints_on_images_copy<EOL><DEDENT>if hooks is not None:<EOL><INDENT>keypoints_on_images_result = hooks.postprocess(keypoints_on_images_result, augmenter=self, parents=parents)<EOL><DEDENT>if self.deterministic:<EOL><INDENT>self.random_state.set_state(state_orig)<EOL><DEDENT>if input_was_single_instance:<EOL><INDENT>return keypoints_on_images_result[<NUM_LIT:0>]<EOL><DEDENT>return keypoints_on_images_result<EOL>

Augment image keypoints.

This is the corresponding function to ``augment_images()``, just for
keypoints/landmarks (i.e. coordinates on the image).
Usually you will want to call ``augment_images()`` with a list of images,
e.g. ``augment_images([A, B, C])`` and then ``augment_keypoints()`` with the
corresponding list of keypoints on these images, e.g.
``augment_keypoints([Ak, Bk, Ck])``, where ``Ak`` are the keypoints on
image ``A``.

Make sure to first convert the augmenter(s) to deterministic states
before augmenting images and their corresponding keypoints,
e.g. by

>>> A = B = C = np.zeros((10, 10), dtype=np.uint8)
>>> Ak = Bk = Ck = ia.KeypointsOnImage([ia.Keypoint(2, 2)], (10, 10))
>>> seq = iaa.Fliplr(0.5)
>>> seq_det = seq.to_deterministic()
>>> imgs_aug = seq_det.augment_images([A, B, C])
>>> kps_aug = seq_det.augment_keypoints([Ak, Bk, Ck])

Otherwise, different random values will be sampled for the image
and keypoint augmentations, resulting in different augmentations (e.g.
images might be rotated by ``30deg`` and keypoints by ``-10deg``).
Also make sure to call `to_deterministic()` again for each new batch,
otherwise you would augment all batches in the same way.

Parameters
----------
keypoints_on_images : imgaug.KeypointsOnImage or \
                      list of imgaug.KeypointsOnImage
    The keypoints/landmarks to augment.
    Expected is an instance of imgaug.KeypointsOnImage or a list of
    imgaug.KeypointsOnImage objects, with each such object containing
    the keypoints of a single image.

parents : None or list of imgaug.augmenters.meta.Augmenter, optional
    Parent augmenters that have previously been called before the
    call to this function. Usually you can leave this parameter as None.
    It is set automatically for child augmenters.

hooks : None or imgaug.HooksKeypoints, optional
    HooksKeypoints object to dynamically interfere with the
    augmentation process.

Returns
-------
keypoints_on_images_result : imgaug.KeypointsOnImage or \
                             list of imgaug.KeypointsOnImage
    Augmented keypoints.


@abstractmethod<EOL><INDENT>def _augment_keypoints(self, keypoints_on_images, random_state, parents, hooks):<DEDENT>

raise NotImplementedError()<EOL>

Augment keypoints on multiple images.

This is the internal variation of ``augment_keypoints()``.
It is called from ``augment_keypoints()`` and should usually not be
called directly. It has to be implemented by every augmenter.
This method may transform the keypoints in-place.
This method does not have to care about determinism or the
Augmenter instance's ``random_state`` variable. The parameter
``random_state`` takes care of both of these.

Parameters
----------
keypoints_on_images : list of imgaug.KeypointsOnImage
    Keypoints to augment. They may be changed in-place.

random_state : numpy.random.RandomState
    The random state to use for all sampling tasks during the augmentation.

parents : list of imgaug.augmenters.meta.Augmenter
    See :func:`imgaug.augmenters.meta.Augmenter.augment_keypoints`.

hooks : imgaug.HooksKeypoints or None
    See :func:`imgaug.augmenters.meta.Augmenter.augment_keypoints`.

Returns
----------
list of imgaug.KeypointsOnImage
    The augmented keypoints.


def augment_bounding_boxes(self, bounding_boxes_on_images, hooks=None):

input_was_single_instance = False<EOL>if isinstance(bounding_boxes_on_images, ia.BoundingBoxesOnImage):<EOL><INDENT>input_was_single_instance = True<EOL>bounding_boxes_on_images = [bounding_boxes_on_images]<EOL><DEDENT>kps_ois = []<EOL>for bbs_oi in bounding_boxes_on_images:<EOL><INDENT>kps = []<EOL>for bb in bbs_oi.bounding_boxes:<EOL><INDENT>kps.extend(bb.to_keypoints())<EOL><DEDENT>kps_ois.append(ia.KeypointsOnImage(kps, shape=bbs_oi.shape))<EOL><DEDENT>kps_ois_aug = self.augment_keypoints(kps_ois, hooks=hooks)<EOL>result = []<EOL>for img_idx, kps_oi_aug in enumerate(kps_ois_aug):<EOL><INDENT>bbs_aug = []<EOL>for i in sm.xrange(len(kps_oi_aug.keypoints) // <NUM_LIT:4>):<EOL><INDENT>bb_kps = kps_oi_aug.keypoints[i*<NUM_LIT:4>:i*<NUM_LIT:4>+<NUM_LIT:4>]<EOL>x1 = min([kp.x for kp in bb_kps])<EOL>x2 = max([kp.x for kp in bb_kps])<EOL>y1 = min([kp.y for kp in bb_kps])<EOL>y2 = max([kp.y for kp in bb_kps])<EOL>bbs_aug.append(<EOL>bounding_boxes_on_images[img_idx].bounding_boxes[i].copy(<EOL>x1=x1,<EOL>y1=y1,<EOL>x2=x2,<EOL>y2=y2<EOL>)<EOL>)<EOL><DEDENT>result.append(<EOL>ia.BoundingBoxesOnImage(<EOL>bbs_aug,<EOL>shape=kps_oi_aug.shape<EOL>)<EOL>)<EOL><DEDENT>if input_was_single_instance:<EOL><INDENT>return result[<NUM_LIT:0>]<EOL><DEDENT>return result<EOL>

Augment bounding boxes.

This is the corresponding function to ``augment_keypoints()``, just for
bounding boxes.
Usually you will want to call ``augment_images()`` with a list of images,
e.g. ``augment_images([A, B, C])`` and then ``augment_bounding_boxes()``
with the corresponding list of bounding boxes on these images, e.g.
``augment_bounding_boxes([Abb, Bbb, Cbb])``, where ``Abb`` are the
bounding boxes on image ``A``.

Make sure to first convert the augmenter(s) to deterministic states
before augmenting images and their corresponding bounding boxes,
e.g. by

>>> A = B = C = np.ones((10, 10), dtype=np.uint8)
>>> Abb = Bbb = Cbb = ia.BoundingBoxesOnImage([ia.BoundingBox(1, 1, 9, 9)], (10, 10))
>>> seq = iaa.Fliplr(0.5)
>>> seq_det = seq.to_deterministic()
>>> imgs_aug = seq_det.augment_images([A, B, C])
>>> bbs_aug = seq_det.augment_bounding_boxes([Abb, Bbb, Cbb])

Otherwise, different random values will be sampled for the image
and bounding box augmentations, resulting in different augmentations
(e.g. images might be rotated by ``30deg`` and bounding boxes by
``-10deg``). Also make sure to call ``to_deterministic()`` again for
each new batch, otherwise you would augment all batches in the same
way.

Parameters
----------
bounding_boxes_on_images : imgaug.BoundingBoxesOnImage or \
                           list of imgaug.BoundingBoxesOnImage
    The bounding boxes to augment.
    Expected is an instance of imgaug.BoundingBoxesOnImage or a list of
    imgaug.BoundingBoxesOnImage objects, with each such object
    containing the bounding boxes of a single image.

hooks : None or imgaug.HooksKeypoints, optional
    HooksKeypoints object to dynamically interfere with the
    augmentation process.

Returns
-------
result : imgaug.BoundingBoxesOnImage or \
         list of imgaug.BoundingBoxesOnImage
    Augmented bounding boxes.


def augment_polygons(self, polygons_on_images, parents=None, hooks=None):

from imgaug.augmentables.polys import PolygonsOnImage<EOL>def _subaugment(polygons_on_images_, random_state_, parents_, hooks_):<EOL><INDENT>return self._augment_polygons(<EOL>polygons_on_images_,<EOL>random_state=random_state_,<EOL>parents=parents_,<EOL>hooks=hooks_<EOL>)<EOL><DEDENT>return self._augment_coord_augables(<EOL>cls_expected=PolygonsOnImage,<EOL>subaugment_func=_subaugment,<EOL>augables_ois=polygons_on_images,<EOL>parents=parents,<EOL>hooks=hooks<EOL>)<EOL>

Augment polygons.

This is the corresponding function to ``augment_keypoints()``, just for
polygons.
Usually you will want to call ``augment_images()`` with a list of
images, e.g. ``augment_images([A, B, C])`` and then
``augment_polygons()`` with the corresponding list of polygons on these
images, e.g. ``augment_polygons([A_poly, B_poly, C_poly])``, where
``A_poly`` are the polygons on image ``A``.

Make sure to first convert the augmenter(s) to deterministic states
before augmenting images and their corresponding polygons,
e.g. by

>>> import imgaug as ia
>>> import imgaug.augmenters as iaa
>>> A = B = C = np.ones((10, 10), dtype=np.uint8)
>>> Apoly = Bpoly = Cpoly = ia.PolygonsOnImage(
>>>     [ia.Polygon([(0, 0), (1, 0), (1, 1), (0, 1)])],
>>>     shape=(10, 10))
>>> seq = iaa.Fliplr(0.5)
>>> seq_det = seq.to_deterministic()
>>> imgs_aug = seq_det.augment_images([A, B, C])
>>> polys_aug = seq_det.augment_polygons([Apoly, Bpoly, Cpoly])

Otherwise, different random values will be sampled for the image
and polygon augmentations, resulting in different augmentations
(e.g. images might be rotated by ``30deg`` and polygons by
``-10deg``). Also make sure to call ``to_deterministic()`` again for
each new batch, otherwise you would augment all batches in the same
way.

Parameters
----------
polygons_on_images : imgaug.PolygonsOnImage or \
                     list of imgaug.PolygonsOnImage
    The polygons to augment.
    Expected is an instance of imgaug.PolygonsOnImage or a list of
    imgaug.PolygonsOnImage objects, with each such object
    containing the polygons of a single image.

parents : None or list of imgaug.augmenters.meta.Augmenter, optional
    Parent augmenters that have previously been called before the
    call to this function. Usually you can leave this parameter as None.
    It is set automatically for child augmenters.

hooks : None or imgaug.HooksKeypoints, optional
    HooksKeypoints object to dynamically interfere with the
    augmentation process.

Returns
-------
result : imgaug.PolygonsOnImage or list of imgaug.PolygonsOnImage
    Augmented polygons.


def augment_line_strings(self, line_strings_on_images, parents=None,<EOL>hooks=None):

from imgaug.augmentables.lines import LineStringsOnImage<EOL>def _subaugment(line_strings_on_images_, random_state_, parents_, hooks_):<EOL><INDENT>return self._augment_line_strings(<EOL>line_strings_on_images_,<EOL>random_state=random_state_,<EOL>parents=parents_,<EOL>hooks=hooks_<EOL>)<EOL><DEDENT>return self._augment_coord_augables(<EOL>cls_expected=LineStringsOnImage,<EOL>subaugment_func=_subaugment,<EOL>augables_ois=line_strings_on_images,<EOL>parents=parents,<EOL>hooks=hooks<EOL>)<EOL>

Augment line strings.

This is the corresponding function to ``augment_keypoints()``, just for
line strings.
Usually you will want to call ``augment_images()`` with a list of
images, e.g. ``augment_images([A, B, C])`` and then
``augment_line_strings()``
with the corresponding list of line strings on these images, e.g.
``augment_line_strings([A_line, B_line, C_line])``, where ``A_line``
are the line strings on image ``A``.

Make sure to first convert the augmenter(s) to deterministic states
before augmenting images and their corresponding line strings,
e.g. by

>>> import imgaug as ia
>>> import imgaug.augmenters as iaa
>>> A = B = C = np.ones((10, 10), dtype=np.uint8)
>>> A_line = B_line = C_line = ia.LineStringsOnImage(
>>>     [ia.LineString([(0, 0), (1, 0), (1, 1), (0, 1)])],
>>>     shape=(10, 10))
>>> seq = iaa.Fliplr(0.5)
>>> seq_det = seq.to_deterministic()
>>> imgs_aug = seq_det.augment_images([A, B, C])
>>> lines_aug = seq_det.augment_line_strings([A_line, B_line, C_line])

Otherwise, different random values will be sampled for the image
and line string augmentations, resulting in different augmentations
(e.g. images might be rotated by ``30deg`` and line strings by
``-10deg``). Also make sure to call ``to_deterministic()`` again for
each new batch, otherwise you would augment all batches in the same
way.

Parameters
----------
line_strings_on_images : imgaug.augmentables.lines.LineStringsOnImage \
                         or list of imgaug.augmentables.lines.LineStringsOnImage
    The line strings to augment.
    Expected is an instance of LineStringsOnImage or a list of
    LineStringsOnImage objects, with each such object containing the
    line strings of a single image.

parents : None or list of imgaug.augmenters.meta.Augmenter, optional
    Parent augmenters that have previously been called before the
    call to this function. Usually you can leave this parameter as None.
    It is set automatically for child augmenters.

hooks : None or imgaug.HooksKeypoints, optional
    HooksKeypoints object to dynamically interfere with the
    augmentation process.

Returns
-------
imgaug.augmentables.lines.LineStringsOnImage \
or list of imgaug.augmentables.lines.LineStringsOnImage
    Augmented line strings.


def _augment_coord_augables(self, cls_expected, subaugment_func,<EOL>augables_ois, parents=None,<EOL>hooks=None):

if self.deterministic:<EOL><INDENT>state_orig = self.random_state.get_state()<EOL><DEDENT>if parents is None:<EOL><INDENT>parents = []<EOL><DEDENT>input_was_single_instance = False<EOL>if isinstance(augables_ois, cls_expected):<EOL><INDENT>input_was_single_instance = True<EOL>augables_ois = [augables_ois]<EOL><DEDENT>ia.do_assert(ia.is_iterable(augables_ois))<EOL>ia.do_assert(all([isinstance(augable_oi, cls_expected)<EOL>for augable_oi in augables_ois]))<EOL>augables_ois_copy = augables_ois<EOL>if len(parents) == <NUM_LIT:0> or hooks is not None:<EOL><INDENT>augables_ois_copy = [augable_oi.deepcopy()<EOL>for augable_oi<EOL>in augables_ois]<EOL><DEDENT>if hooks is not None:<EOL><INDENT>augables_ois_copy = hooks.preprocess(<EOL>augables_ois_copy, augmenter=self, parents=parents)<EOL><DEDENT>augables_ois_result = augables_ois_copy<EOL>is_activated = (hooks is None and self.activated)<EOL>is_activated_hooks = (is_activated is False) and (<EOL>hooks is not None<EOL>and hooks.is_activated(augables_ois_copy,<EOL>augmenter=self, parents=parents,<EOL>default=self.activated)<EOL>)<EOL>if is_activated or is_activated_hooks:<EOL><INDENT>if len(augables_ois) > <NUM_LIT:0>:<EOL><INDENT>augables_ois_result = subaugment_func(<EOL>augables_ois_copy,<EOL>ia.copy_random_state(self.random_state),<EOL>parents,<EOL>hooks<EOL>)<EOL>ia.forward_random_state(self.random_state)<EOL><DEDENT><DEDENT>if hooks is not None:<EOL><INDENT>augables_ois_result = hooks.postprocess(<EOL>augables_ois_result, augmenter=self, parents=parents)<EOL><DEDENT>if self.deterministic:<EOL><INDENT>self.random_state.set_state(state_orig)<EOL><DEDENT>if input_was_single_instance:<EOL><INDENT>return augables_ois_result[<NUM_LIT:0>]<EOL><DEDENT>return augables_ois_result<EOL>

Augment coordinate-based augmentables.

This is an abstract function called by keypoints, bounding boxes,
polygons and line strings.
TODO keypoints, bounding boxes currently missing -- add them

Parameters
----------
cls_expected : class
    Class type that is expected. `augmentables_ois` will be
    verified to use that class.

subaugment_func : callable
    Function that will be called to actually augment the data.

augables_ois : imgaug.augmentables.polys.PolygonsOnImage \
               or imgaug.augmentables.lines.LineStringsOnImage \
               or list of imgaug.augmentables.lines.LineStringsOnImage \
               or list of imgaug.augmentables.polys.PolygonsOnImage
    The augmentables to augment. `augables_ois` is the abbreviation for
    "augmentables_on_images". Expected are the augmentables on a
    single image (single instance) or 1+ images (list of instances).

parents : None or list of imgaug.augmenters.meta.Augmenter, optional
    Parent augmenters that have previously been called before the
    call to this function. Usually you can leave this parameter as None.
    It is set automatically for child augmenters.

hooks : None or imgaug.HooksKeypoints, optional
    HooksKeypoints object to dynamically interfere with the
    augmentation process.

Returns
-------
imgaug.augmentables.polys.PolygonsOnImage \
or imgaug.augmentables.lines.LineStringsOnImage \
or list of imgaug.augmentables.polys.PolygonsOnImage \
or list of imgaug.augmentables.lines.LineStringsOnImage
    Augmented augmentables.


def _augment_polygons(self, polygons_on_images, random_state, parents,<EOL>hooks):

return polygons_on_images<EOL>

Augment polygons on images.

This is the internal version of ``augment_polygons()``.
It is called from ``augment_polygons()`` and should usually not be
called directly.
This method may transform the polygons in-place.
This method does not have to care about determinism or the
Augmenter instance's ``random_state`` variable. The parameter
``random_state`` takes care of both of these.

Parameters
----------
polygons_on_images : list of imgaug.PolygonsOnImage
    Polygons to augment. They may be changed in-place.

random_state : numpy.random.RandomState
    The random state to use for all sampling tasks during the
    augmentation.

parents : list of imgaug.augmenters.meta.Augmenter
    See :func:`imgaug.augmenters.meta.Augmenter.augment_polygons`.

hooks : imgaug.HooksKeypoints or None
    See :func:`imgaug.augmenters.meta.Augmenter.augment_polygons`.

Returns
----------
list of imgaug.PolygonsOnImage
    The augmented polygons.