cutcutcodec.core.nn.dataaug.image

Image Data Augmentations.

Classes

RandomResizedCrop(shape[, win_area])

Resize and Crop an image to reach a final size.

Details

class cutcutcodec.core.nn.dataaug.image.RandomResizedCrop(shape: tuple[Integral, Integral] | list[Integral], win_area: tuple[Real, Real] | list[Real] | None = (1.0, 9.0))[source]

Resize and Crop an image to reach a final size.

It consists in random rescale and random cropping. It conserve the proportion of the input image.

Attributes

shapetuple[int, int]

The output shape (readonly).

Examples

>>> import torch
>>> from cutcutcodec.core.classes.frame_video import FrameVideo
>>> from cutcutcodec.core.nn.dataaug.image import RandomResizedCrop
>>> image = FrameVideo(0, torch.rand((480, 720, 3)))
>>> dataaug = RandomResizedCrop((16, 16))
>>> dataaug(image).shape
(16, 16, 3)
>>>

Initialise and create the class.

Parameters

shapeint and int

The pixel dimensions of the final image. The convention adopted is the numpy convention (height, width).

win_areafloat and float

The max and min ratio of the total surface by the window surface.