Resize¶
- class torchaug.transforms.Resize(size, interpolation=InterpolationMode.BILINEAR, max_size=None, antialias=True)[source]¶
Resize the input to the given 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:
size (
Union[int,Sequence[int]]) –Desired output size. If size is a sequence like (h, w), output size will be matched to this. If size is an int, smaller edge of the image will be matched to this number. i.e, if height > width, then image will be rescaled to (size * height / width, size).
Note
In torchscript mode size as single int is not supported, use a sequence of length 1:
[size, ].interpolation (
Union[InterpolationMode,int], optional) – Desired interpolation enum defined bytorchvision.transforms.InterpolationMode. If input is Tensor, onlyInterpolationMode.NEAREST,InterpolationMode.NEAREST_EXACT,InterpolationMode.BILINEARandInterpolationMode.BICUBICare supported. The corresponding Pillow integer constants, e.g.PIL.Image.BILINEARare accepted as well. Default:InterpolationMode.BILINEARmax_size (
Optional[int], optional) – The maximum allowed for the longer edge of the resized image. If the longer edge of the image is greater thanmax_sizeafter being resized according tosize,sizewill be overruled so that the longer edge is equal tomax_size. As a result, the smaller edge may be shorter thansize. This is only supported ifsizeis an int (or a sequence of length 1 in torchscript mode). Default:Noneantialias (
bool, optional) – Whether to apply antialiasing. Default:True