kd.data.py.CenterCrop

kd.data.py.CenterCrop#

class kauldron.data.py.CenterCrop(*, 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.transforms.base.ElementWiseTransform

Crop the input data to the specified shape from the center.

Can be used on data of any shape or type including images and videos. This transform does NOT support dynamic shapes, i.e., shapes with -1 in any of the dimensions.

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, ...]
map_element(
element: jaxtyping.Shaped[Tensor, '...'] | jaxtyping.Shaped[ndarray, '...'] | jaxtyping.Shaped[Array, '...'],
) jaxtyping.Shaped[Tensor, '...'] | jaxtyping.Shaped[ndarray, '...'] | jaxtyping.Shaped[Array, '...'][source]
key: kontext.Key | Sequence[kontext.Key] | dict[kontext.Key, kontext.Key]