RandomResize¶
- class torchaug.transforms.RandomResize(min_size, max_size, interpolation=InterpolationMode.BILINEAR, antialias=True)[source]¶
Randomly resize the input.
This transformation can be used together with
RandomCropas data augmentations to train models on image segmentation task.Output spatial size is randomly sampled from the interval
[min_size, max_size]:size = uniform_sample(min_size, max_size) output_width = size output_height = size
If the input is a
torch.Tensoror aTATensor(e.g.Image,Video,BoundingBoxesetc.) it can have arbitrary number of leading batch dimensions. For example, the image can have[..., C, H, W]shape. A bounding box can have[..., 4]shape.- Parameters:
min_size (
int) – Minimum output size for random samplingmax_size (
int) – Maximum output size for random samplinginterpolation (
Union[InterpolationMode,int], optional) – Desired interpolation enum defined bytorchvision.transforms.InterpolationMode. OnlyInterpolationMode.NEAREST,InterpolationMode.NEAREST_EXACT,InterpolationMode.BILINEARandInterpolationMode.BICUBICare supported. Default:InterpolationMode.BILINEARantialias (
bool, optional) – Whether to apply antialiasing. Default:True