kd.data.py.Resize#
- class kauldron.data.py.Resize(*, 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>]], size: tuple[int, int] | None = None, min_size: int | None = None, max_size: int | None = None, method: str | jax._src.image.scale.ResizeMethod | tensorflow.python.ops.image_ops_impl.ResizeMethod | None = None, antialias: bool = True)[source]
Bases:
kauldron.data.transforms.base.ElementWiseTransformResizes an image.
At most one of size, min_size, and max_size must be set.
- size
The new size of the image. If set, the image is rescaled so that the new size matches size.
- Type:
tuple[int, int] | None
- min_size
The minimum size of the image. If set, the image is rescaled so that the smaller edge matches min_size.
- Type:
int | None
- max_size
The maximum size of the image. If set, the image is rescaled so that the larger edge matches max_size.
- Type:
int | None
- method
The resizing method. If None, uses area for float TF inputs, bilinear for float JAX inputs, and nearest for int inputs.
- Type:
str | jax._src.image.scale.ResizeMethod | tensorflow.python.ops.image_ops_impl.ResizeMethod | None
- antialias
Whether to use an anti-aliasing filter.
- Type:
bool
- size: tuple[int, int] | None = None
- min_size: int | None = None
- max_size: int | None = None
- method: str | jax._src.image.scale.ResizeMethod | tensorflow.python.ops.image_ops_impl.ResizeMethod | None = None
- antialias: bool = True
- map_element(
- element: jaxtyping.Shaped[Tensor, '*b h w c'] | jaxtyping.Shaped[ndarray, '*b h w c'] | jaxtyping.Shaped[Array, '*b h w c'],
- key: kontext.Key | Sequence[kontext.Key] | dict[kontext.Key, kontext.Key]