Module ImportFrom alias ImportFrom alias Import alias Import alias ImportFrom alias ImportFrom alias TryExcept body ImportFrom alias Assign NameStore NameLoad handlers ExceptHandler type NameLoad body Assign NameStore NameLoad ImportFrom alias alias ImportFrom alias ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam defaults Str kwarg body Expr Call AttributeLoad NameLoad attr Str AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Str AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad SubscriptLoad NameLoad Index Str Expr Call AttributeLoad NameLoad attr Str NameLoad Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr NameLoad NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body If NameLoad body Assign NameStore NameLoad orelse Assign NameStore NameLoad If UnaryOpNot Call NameLoad NameLoad NameLoad body Raise Call NameLoad Call AttributeLoad Str attr AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Call NameLoad NameLoad If CompareIsNot AttributeLoad NameLoad attr NameLoad body Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad If CompareEq AttributeLoad NameLoad attr Num body Return Call AttributeLoad NameLoad attr Num Num Num orelse If CompareEq AttributeLoad NameLoad attr Num body Assign NameStore SubscriptLoad NameLoad Index AttributeLoad NameLoad attr orelse Raise Call NameLoad Str Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Return ListComp Call AttributeLoad NameLoad attr NameLoad NameLoad comprehension NameStore NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Assign NameStore Dict For NameStore AttributeLoad NameLoad attr body If CompareIn NameLoad NameLoad body If NameLoad body Assign SubscriptStore NameLoad Index NameLoad TupleLoad Str Str Str orelse Assign SubscriptStore NameLoad Index NameLoad TupleLoad Str Str Str Str orelse Assign SubscriptStore NameLoad Index NameLoad IfExp CompareIn NameLoad AttributeLoad NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Index NameLoad NameLoad Return NameLoad decorator_list decorator_list ClassDef bases NameLoad NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam defaults Str kwarg body Assign AttributeStore NameLoad attr NameLoad TryExcept body Assign AttributeStore NameLoad attr Call NameLoad NameLoad Call AttributeLoad NameLoad attr handlers ExceptHandler type NameLoad body Raise Call NameLoad Call AttributeLoad Str attr NameLoad Expr Call AttributeLoad NameLoad attr Str AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str AttributeLoad NameLoad attr Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Call AttributeLoad NameLoad attr TupleLoad Str Str Str Str SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index NameLoad NameLoad Return ListComp Call AttributeLoad NameLoad attr NameLoad NameLoad comprehension NameStore NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Call AttributeLoad NameLoad attr TupleLoad Str Str Str SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index NameLoad NameLoad Return Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body If BoolOpOr CompareGt AttributeLoad NameLoad attr Num CompareLt AttributeLoad NameLoad attr Num body Raise NameLoad Assign TupleStore NameStore NameStore AttributeLoad NameLoad attr Assign TupleStore NameStore NameStore SubscriptLoad AttributeLoad NameLoad attr Slice Num If BoolOpOr CompareLt NameLoad NameLoad CompareLt NameLoad NameLoad body Assign NameStore AttributeLoad NameLoad attr If CompareEq AttributeLoad NameLoad attr Num body Assign NameStore Call AttributeLoad NameLoad attr Num Num Num orelse Assign NameStore NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign TupleStore NameStore NameStore AttributeLoad NameLoad attr Assign NameStore Call NameLoad Num BinOpDiv NameLoad NameLoad BinOpDiv NameLoad NameLoad Assign NameStore Call NameLoad Call AttributeLoad NameLoad attr BinOpMult NameLoad NameLoad Assign NameStore Call NameLoad Call AttributeLoad NameLoad attr BinOpMult NameLoad NameLoad Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad attr NameLoad If CompareEq AttributeLoad NameLoad attr Num body Assign NameStore Call AttributeLoad NameLoad attr Num Num Num orelse Assign NameStore NameLoad Return NameLoad decorator_list decorator_list ClassDef bases NameLoad NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam defaults kwarg body If UnaryOpNot NameLoad body Raise Call NameLoad Str Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Str NameLoad Assign AttributeStore NameLoad attr NameLoad If CompareIs AttributeLoad NameLoad attr NameLoad body Assign AttributeStore NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str AttributeLoad NameLoad attr Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Call AttributeLoad NameLoad attr TupleLoad Str Str Str Str SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index NameLoad NameLoad Assign TupleStore NameStore NameStore AttributeLoad NameLoad attr If BoolOpAnd Call NameLoad NameLoad AttributeLoad NameLoad attr CompareEq AttributeLoad NameLoad attr Num body Assign NameStore Call AttributeLoad NameLoad attr BinOpAdd SubscriptLoad AttributeLoad NameLoad attr Slice Num AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index Num Assign TupleStore NameStore NameStore SubscriptLoad AttributeLoad NameLoad attr Slice Num Assign NameStore BinOpSub NameLoad NameLoad Assign NameStore BinOpSub NameLoad NameLoad If BoolOpOr CompareLt NameLoad Num CompareLt NameLoad Num body Raise Call NameLoad Call AttributeLoad Str attr SubscriptLoad AttributeLoad NameLoad attr Slice Num AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Num NameLoad keyword NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Num NameLoad keyword NameLoad Expr Call NameLoad NameLoad NameLoad NameLoad NameLoad Return NameLoad orelse If Call NameLoad GeneratorExp BoolOpAnd Call NameLoad NameLoad AttributeLoad NameLoad attr CompareEq AttributeLoad NameLoad attr Num comprehension NameStore NameLoad body Return ListComp Call AttributeLoad NameLoad attr NameLoad NameLoad comprehension NameStore NameLoad orelse Raise Call NameLoad Str decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Call AttributeLoad NameLoad attr TupleLoad Str Str Str SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index NameLoad NameLoad Assign TupleStore NameStore NameStore AttributeLoad NameLoad attr If BoolOpOr UnaryOpNot Call NameLoad NameLoad AttributeLoad NameLoad attr CompareNotEq AttributeLoad NameLoad attr Num body Raise Call NameLoad Str Assign TupleStore NameStore NameStore SubscriptLoad AttributeLoad NameLoad attr Slice Num If BoolOpOr CompareLt NameLoad NameLoad CompareLt NameLoad NameLoad body Raise Call NameLoad Call AttributeLoad Str attr NameLoad NameLoad NameLoad NameLoad If CompareGt BinOpSub NameLoad NameLoad Num body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Num BinOpSub NameLoad NameLoad orelse Assign NameStore Num If CompareGt BinOpSub NameLoad NameLoad Num body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Num BinOpSub NameLoad NameLoad orelse Assign NameStore Num Return SubscriptLoad NameLoad ExtSlice Slice Slice NameLoad BinOpAdd NameLoad NameLoad Slice NameLoad BinOpAdd NameLoad NameLoad decorator_list decorator_list ClassDef bases NameLoad NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam defaults AttributeLoad NameLoad attr Str kwarg body If BoolOpOr CompareLtE NameLoad Num CompareGt NameLoad AttributeLoad NameLoad attr body Raise Call NameLoad Call AttributeLoad Str attr NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr NameLoad TryExcept body Assign AttributeStore NameLoad attr Call NameLoad NameLoad Call AttributeLoad NameLoad attr handlers ExceptHandler type NameLoad body Raise Call NameLoad Call AttributeLoad Str attr NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Str NameLoad Assign AttributeStore NameLoad attr NameLoad If CompareIs AttributeLoad NameLoad attr NameLoad body Assign AttributeStore NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str AttributeLoad NameLoad attr Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Call AttributeLoad NameLoad attr TupleLoad Str Str Str Str SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index NameLoad NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr UnaryOpUSub AttributeLoad NameLoad attr AttributeLoad NameLoad attr Call NameLoad NameLoad If BoolOpAnd Call NameLoad NameLoad NameLoad Call NameLoad GeneratorExp BoolOpAnd Call NameLoad NameLoad AttributeLoad NameLoad attr CompareEq AttributeLoad NameLoad attr Num comprehension NameStore NameLoad body Return ListComp Call AttributeLoad NameLoad attr NameLoad NameLoad comprehension TupleStore NameStore NameStore Call NameLoad NameLoad NameLoad orelse If BoolOpAnd Call NameLoad NameLoad AttributeLoad NameLoad attr CompareEq AttributeLoad NameLoad attr NameLoad Call NameLoad GeneratorExp BoolOpAnd Call NameLoad NameLoad AttributeLoad NameLoad attr CompareEq AttributeLoad NameLoad attr Num comprehension NameStore NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Call NameLoad NameLoad keyword NameLoad For TupleStore NameStore TupleStore NameStore NameStore Call NameLoad Call NameLoad NameLoad NameLoad body Assign SubscriptStore NameLoad Index NameLoad Call AttributeLoad NameLoad attr NameLoad NameLoad Return NameLoad orelse If BoolOpAnd Call NameLoad NameLoad AttributeLoad NameLoad attr CompareEq AttributeLoad NameLoad attr Num body Return Call AttributeLoad NameLoad attr ListComp Call AttributeLoad NameLoad attr NameLoad NameLoad comprehension TupleStore NameStore NameStore Call NameLoad NameLoad NameLoad keyword AttributeLoad NameLoad attr orelse Raise Call NameLoad Str decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Call AttributeLoad NameLoad attr TupleLoad Str Str Str SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index NameLoad NameLoad If BoolOpOr UnaryOpNot Call NameLoad NameLoad AttributeLoad NameLoad attr CompareNotEq AttributeLoad NameLoad attr Num body Raise Call NameLoad Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr UnaryOpUSub AttributeLoad NameLoad attr AttributeLoad NameLoad attr Return Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Assign NameStore AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num Num Num Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad keyword AttributeLoad NameLoad attr attr NameLoad Return Call AttributeLoad NameLoad attr Num Num Num decorator_list decorator_list
N/A __future__ division io BytesIO N/A math N/A numpy PIL Image six PY3 N/A N/A _image window_batch_bchw N/A window_batch_bchw_available True N/A N/A N/A ImportError N/A N/A window_batch_bchw_available False N/A ExpectsAxisLabels SourcewiseTransformer N/A config ImagesFromBytes N/A SourcewiseTransformer N/A N/A Load from a stream of bytes objects representing encoded images.

    Parameters
    ----------
    data_stream : instance of :class:`AbstractDataStream`
        The wrapped data stream. The individual examples returned by this
        should be the bytes (in a `bytes` container, or a `str` on legacy
        Python) comprising an image in a format readable by PIL, such as
        PNG, JPEG, etc.
    color_mode : str, optional
        Mode to pass to PIL for color space conversion. Default is RGB.
        If `None`, no coercion is performed.

    Notes
    -----
    Images are returned as NumPy arrays converted from PIL objects.
    If there is more than one color channel, then the array is transposed
    from the `(height, width, channel)` dimension layout native to PIL to
    the `(channel, height, width)` layout that is pervasive in the world
    of convolutional networks. If there is only one color channel, as for
    monochrome or binary images, a leading axis with length 1 is added for
    the sake of uniformity/predictability.

    This SourcewiseTransformer supports streams returning single examples
    as `bytes` objects (`str` on legacy Python) as well as streams that
    return iterables containing such objects. In the case of an iterable, a
    list of loaded images is returned.

     __init__ N/A N/A self data_stream color_mode N/A RGB kwargs N/A N/A N/A N/A kwargs setdefault produces_examples N/A data_stream produces_examples N/A which_sources N/A N/A kwargs get which_sources N/A data_stream sources N/A axis_labels N/A N/A self _make_axis_labels data_stream which_sources N/A kwargs N/A produces_examples N/A N/A N/A kwargs setdefault axis_labels axis_labels N/A N/A N/A N/A super ImagesFromBytes self __init__ data_stream kwargs N/A N/A self color_mode color_mode N/A transform_source_example N/A N/A self example source_name N/A N/A N/A PY3 N/A N/A bytes_type bytes N/A N/A bytes_type str N/A N/A N/A isinstance example bytes_type N/A N/A N/A TypeError N/A N/A expected {} object format N/A bytes_type __name__ N/A pil_image N/A N/A Image open N/A BytesIO example N/A N/A N/A self color_mode None N/A N/A pil_image N/A N/A pil_image convert N/A self color_mode N/A image N/A N/A numpy array pil_image N/A N/A N/A image ndim 3 N/A N/A N/A N/A image transpose 2 0 1 N/A N/A N/A N/A image ndim 2 N/A N/A image N/A image N/A N/A numpy newaxis N/A N/A N/A ValueError unexpected number of axes N/A image N/A transform_source_batch N/A N/A self batch source_name N/A N/A N/A N/A N/A N/A self transform_source_example im source_name N/A im batch N/A _make_axis_labels N/A N/A self data_stream which_sources produces_examples N/A N/A N/A labels N/A N/A source N/A data_stream sources N/A N/A N/A source which_sources N/A N/A produces_examples N/A N/A N/A labels N/A source N/A channel height width N/A N/A N/A labels N/A source N/A batch channel height width N/A N/A N/A labels N/A source N/A N/A source N/A data_stream axis_labels N/A N/A data_stream axis_labels N/A source None N/A labels N/A N/A MinimumImageDimensions N/A SourcewiseTransformer ExpectsAxisLabels N/A N/A Resize (lists of) images to minimum dimensions.

    Parameters
    ----------
    data_stream : instance of :class:`AbstractDataStream`
        The data stream to wrap.
    minimum_shape : 2-tuple
        The minimum `(height, width)` dimensions every image must have.
        Images whose height and width are larger than these dimensions
        are passed through as-is.
    resample : str, optional
        Resampling filter for PIL to use to upsample any images requiring
        it. Options include 'nearest' (default), 'bilinear', and 'bicubic'.
        See the PIL documentation for more detailed information.

    Notes
    -----
    This transformer expects stream sources returning individual images,
    represented as 2- or 3-dimensional arrays, or lists of the same.
    The format of the stream is unaltered.

     __init__ N/A N/A self data_stream minimum_shape resample N/A nearest kwargs N/A N/A N/A self minimum_shape minimum_shape N/A N/A N/A N/A self resample N/A getattr Image N/A N/A resample upper N/A N/A N/A AttributeError N/A N/A N/A ValueError N/A N/A unknown resampling filter '{}' format resample N/A N/A N/A kwargs setdefault produces_examples N/A data_stream produces_examples N/A N/A N/A kwargs setdefault axis_labels N/A data_stream axis_labels N/A N/A N/A N/A super MinimumImageDimensions self __init__ data_stream kwargs N/A transform_source_batch N/A N/A self batch source_name N/A N/A N/A N/A N/A self verify_axis_labels N/A batch channel height width N/A N/A N/A self data_stream axis_labels N/A source_name source_name N/A N/A N/A N/A self _example_transform im source_name N/A im batch N/A transform_source_example N/A N/A self example source_name N/A N/A N/A N/A N/A self verify_axis_labels N/A channel height width N/A N/A N/A self data_stream axis_labels N/A source_name source_name N/A N/A N/A self _example_transform example source_name N/A _example_transform N/A N/A self example _ N/A N/A N/A N/A N/A N/A example ndim 3 N/A N/A example ndim 2 N/A N/A NotImplementedError N/A N/A min_height min_width N/A self minimum_shape N/A N/A original_height original_width N/A N/A example shape N/A -2 N/A N/A N/A original_height min_height N/A original_width min_width N/A N/A dt N/A example dtype N/A N/A N/A example ndim 3 N/A N/A im N/A N/A example transpose 1 2 0 N/A N/A im example N/A im N/A N/A Image fromarray im N/A N/A width height N/A im size N/A multiplier N/A max 1 N/A min_width width N/A min_height height N/A width N/A int N/A N/A math ceil N/A width multiplier N/A height N/A int N/A N/A math ceil N/A height multiplier N/A im N/A N/A N/A N/A numpy array N/A N/A im resize N/A width height astype dt N/A N/A N/A im ndim 3 N/A N/A example N/A N/A im transpose 2 0 1 N/A N/A example im N/A example N/A N/A RandomFixedSizeCrop N/A SourcewiseTransformer ExpectsAxisLabels N/A N/A Randomly crop images to a fixed window size.

    Parameters
    ----------
    data_stream : :class:`AbstractDataStream`
        The data stream to wrap.
    window_shape : tuple
        The `(height, width)` tuple representing the size of the output
        window.

    Notes
    -----
    This transformer expects to act on stream sources which provide one of

     * Single images represented as 3-dimensional ndarrays, with layout
       `(channel, height, width)`.
     * Batches of images represented as lists of 3-dimensional ndarrays,
       possibly of different shapes (i.e. images of differing
       heights/widths).
     * Batches of images represented as 4-dimensional ndarrays, with
       layout `(batch, channel, height, width)`.

    The format of the stream will be un-altered, i.e. if lists are
    yielded by `data_stream` then lists will be yielded by this
    transformer.

     __init__ N/A N/A self data_stream window_shape N/A kwargs N/A N/A N/A window_batch_bchw_available N/A N/A N/A ImportError window_batch_bchw not compiled N/A N/A self window_shape window_shape N/A N/A self rng N/A N/A kwargs pop rng None N/A N/A self warned_axis_labels False N/A N/A N/A self rng None N/A N/A N/A self rng N/A N/A N/A numpy random RandomState N/A config default_seed N/A N/A N/A kwargs setdefault produces_examples N/A data_stream produces_examples N/A N/A N/A kwargs setdefault axis_labels N/A data_stream axis_labels N/A N/A N/A N/A super RandomFixedSizeCrop self __init__ data_stream kwargs N/A transform_source_batch N/A N/A self source source_name N/A N/A N/A N/A N/A self verify_axis_labels N/A batch channel height width N/A N/A N/A self data_stream axis_labels N/A source_name source_name N/A N/A windowed_height windowed_width N/A self window_shape N/A N/A N/A isinstance source N/A numpy ndarray N/A N/A source ndim 4 N/A N/A out N/A N/A numpy empty N/A N/A N/A source shape N/A 2 N/A self window_shape dtype N/A source dtype N/A batch_size N/A N/A source shape N/A 0 N/A N/A image_height image_width N/A N/A source shape N/A 2 N/A max_h_off N/A image_height windowed_height N/A max_w_off N/A image_width windowed_width N/A N/A N/A max_h_off 0 N/A max_w_off 0 N/A N/A N/A ValueError N/A N/A Got ndarray batch with image dimensions {} but requested window shape of {} format N/A N/A source shape N/A 2 N/A self window_shape N/A offsets_w N/A N/A N/A self rng random_integers 0 max_w_off size batch_size N/A offsets_h N/A N/A N/A self rng random_integers 0 max_h_off size batch_size N/A N/A window_batch_bchw source offsets_h offsets_w out N/A out N/A N/A N/A all N/A N/A N/A isinstance b N/A numpy ndarray N/A N/A b ndim 3 N/A b source N/A N/A N/A N/A N/A self transform_source_example im source_name N/A im source N/A N/A N/A ValueError uninterpretable batch format; expected a list of arrays with ndim = 3, or an array with ndim = 4 N/A transform_source_example N/A N/A self example source_name N/A N/A N/A N/A N/A self verify_axis_labels N/A channel height width N/A N/A N/A self data_stream axis_labels N/A source_name source_name N/A N/A windowed_height windowed_width N/A self window_shape N/A N/A N/A N/A isinstance example N/A numpy ndarray N/A N/A example ndim 3 N/A N/A N/A ValueError uninterpretable example format; expected ndarray with ndim = 3 N/A N/A image_height image_width N/A N/A example shape N/A 1 N/A N/A N/A image_height windowed_height N/A image_width windowed_width N/A N/A N/A ValueError N/A N/A can't obtain ({}, {}) window from image dimensions ({}, {}) format windowed_height windowed_width image_height image_width N/A N/A N/A image_height windowed_height 0 N/A N/A off_h N/A N/A N/A self rng random_integers 0 N/A image_height windowed_height N/A N/A off_h 0 N/A N/A N/A image_width windowed_width 0 N/A N/A off_w N/A N/A N/A self rng random_integers 0 N/A image_width windowed_width N/A N/A off_w 0 N/A N/A example N/A N/A N/A off_h N/A off_h windowed_height N/A off_w N/A off_w windowed_width N/A N/A Random2DRotation N/A SourcewiseTransformer ExpectsAxisLabels N/A N/A Randomly rotate 2D images in the spatial plane.

    Parameters
    ----------
    data_stream : :class:`AbstractDataStream`
        The data stream to wrap.
    maximum_rotation : float, default `math.pi`
        Maximum amount of rotation in radians. The image will be rotated by
        an angle in the range [-maximum_rotation, maximum_rotation].
    resample : str, optional
        Resampling filter for PIL to use to upsample any images requiring
        it. Options include 'nearest' (default), 'bilinear', and 'bicubic'.
        See the PIL documentation for more detailed information.

    Notes
    -----
    This transformer expects to act on stream sources which provide one of

     * Single images represented as 3-dimensional ndarrays, with layout
       `(channel, height, width)`.
     * Batches of images represented as lists of 3-dimensional ndarrays,
       possibly of different shapes (i.e. images of differing
       heights/widths).
     * Batches of images represented as 4-dimensional ndarrays, with
       layout `(batch, channel, height, width)`.

    The format of the stream will be un-altered, i.e. if lists are
    yielded by `data_stream` then lists will be yielded by this
    transformer.

     __init__ N/A N/A self data_stream maximum_rotation resample N/A N/A math pi nearest kwargs N/A N/A N/A N/A maximum_rotation 0 N/A maximum_rotation N/A math pi N/A N/A N/A ValueError N/A N/A maximum_rotation ({:.5f}) must be in the range (0, math.pi] format maximum_rotation N/A N/A self maximum_rotation N/A N/A numpy rad2deg maximum_rotation N/A N/A N/A N/A self resample N/A getattr Image N/A N/A resample upper N/A N/A N/A AttributeError N/A N/A N/A ValueError N/A N/A unknown resampling filter '{}' format resample N/A N/A self rng N/A N/A kwargs pop rng None N/A N/A self warned_axis_labels False N/A N/A N/A self rng None N/A N/A N/A self rng N/A N/A N/A numpy random RandomState N/A config default_seed N/A N/A N/A kwargs setdefault produces_examples N/A data_stream produces_examples N/A N/A N/A kwargs setdefault axis_labels N/A data_stream axis_labels N/A N/A N/A N/A super Random2DRotation self __init__ data_stream kwargs N/A transform_source_batch N/A N/A self source source_name N/A N/A N/A N/A N/A self verify_axis_labels N/A batch channel height width N/A N/A N/A self data_stream axis_labels N/A source_name source_name N/A rotation_angles N/A N/A N/A self rng uniform N/A N/A self maximum_rotation N/A self maximum_rotation N/A len source N/A N/A N/A isinstance source list N/A all N/A N/A N/A isinstance b N/A numpy ndarray N/A N/A b ndim 3 N/A b source N/A N/A N/A N/A N/A self _example_transform im angle N/A N/A im angle N/A zip source rotation_angles N/A N/A N/A N/A isinstance source N/A numpy ndarray N/A N/A source dtype object N/A all N/A N/A N/A isinstance b N/A numpy ndarray N/A N/A b ndim 3 N/A b source N/A N/A out N/A N/A numpy empty N/A len source dtype object N/A N/A im_idx N/A im angle N/A enumerate N/A zip source rotation_angles N/A N/A N/A out N/A im_idx N/A N/A self _example_transform im angle N/A out N/A N/A N/A N/A isinstance source N/A numpy ndarray N/A N/A source ndim 4 N/A N/A N/A N/A numpy array N/A N/A N/A self _example_transform im angle N/A N/A im angle N/A zip source rotation_angles dtype N/A source dtype N/A N/A N/A ValueError uninterpretable batch format; expected a list of arrays with ndim = 3, or an array with ndim = 4 N/A transform_source_example N/A N/A self example source_name N/A N/A N/A N/A N/A self verify_axis_labels N/A channel height width N/A N/A N/A self data_stream axis_labels N/A source_name source_name N/A N/A N/A N/A isinstance example N/A numpy ndarray N/A N/A example ndim 3 N/A N/A N/A ValueError uninterpretable example format; expected ndarray with ndim = 3 N/A rotation_angle N/A N/A N/A self rng uniform N/A N/A self maximum_rotation N/A self maximum_rotation N/A N/A N/A self _example_transform example rotation_angle N/A _example_transform N/A N/A self example rotation_angle N/A N/A N/A dt N/A example dtype N/A im N/A N/A Image fromarray N/A N/A example transpose 1 2 0 N/A example N/A N/A N/A N/A numpy array N/A N/A im rotate rotation_angle resample N/A self resample astype dt N/A N/A N/A example transpose 2 0 1 N/A N/A