kd.data.py.RandomCrop

kd.data.py.RandomCrop#

class kauldron.data.py.RandomCrop(*, key: typing.Annotated[typing.Any, <object object at 0x76412092fb90>] | typing.Sequence[typing.Annotated[typing.Any, <object object at 0x76412092fb90>]] | dict[typing.Annotated[typing.Any, <object object at 0x76412092fb90>], typing.Annotated[typing.Any, <object object at 0x76412092fb90>]], shape: tuple[int | None, ...])[source]

Bases: kauldron.data.py.random_transforms.ElementWiseRandomTransform

Randomly crop the input data to the specified shape.

Can be used on data of any shape or type including images and videos.

shape

A tuple of integers describing the target shape of the crop. Entries can be also be None to keep the original shape of the data in that dim.

Type:

tuple[int | None, …]

shape: tuple[int | None, ...]
random_map(
features,
rng: numpy.random._generator.Generator,
)[source]

Maps a single element.

random_map_element(
element: jaxtyping.Shaped[Array, '...'] | jaxtyping.Shaped[ndarray, '...'],
rng: numpy.random._generator.Generator,
) jaxtyping.Shaped[Array, '...'] | jaxtyping.Shaped[ndarray, '...'][source]