Загрузка
Randomly resize the input.
If the input is a torch.Tensor or a TVTensor (e.g. Image,
Video, BoundingBoxes etc.)
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.
min_size (int or sequence of python:int) – Minimum spatial size. Single integer value or a sequence of integer values.
max_size (int, optional) – Maximum spatial size. Default, None.
interpolation (str or InterpolationMode, optional) – Desired interpolation enum defined by
torchvision.transforms.v2.InterpolationMode.
Accepted string values are "nearest", "nearest-exact", , ,
, , and .
and are only supported for PIL images.
is only supported on CPU and requires .
Default is .
The corresponding enum values and Pillow integer
constants, e.g. are accepted as well.
"bilinear""bicubic""box""hamming""lanczos""box""hamming""lanczos"antialias=True"bilinear"InterpolationModePIL.Image.BILINEARantialias (bool, optional) –
Whether to apply antialiasing. It only affects tensors with bilinear, bicubic, or lanczos modes and it is ignored otherwise: on PIL images, antialiasing is always applied on bilinear or bicubic modes; on other modes (for PIL images and tensors), antialiasing makes no sense and this parameter is ignored. Possible values are:
True (default): will apply antialiasing for bilinear, bicubic, or lanczos modes.
Other mode aren’t affected. This is probably what you want to use.
False: will not apply antialiasing for tensors on any mode. PIL
images are still antialiased on bilinear or bicubic modes, because
PIL doesn’t support no antialias.
None: equivalent to False for tensors and True for
PIL images. This value exists for legacy reasons and you probably
don’t want to use it unless you really know what you are doing.
The default value changed from None to True in
v0.17, for the PIL and Tensor backends to be consistent.