BatchRandomResizedCrop#
- class torchaug.batch_transforms.BatchRandomResizedCrop(size, scale=(0.08, 1.0), ratio=(0.75, 1.3333333333333333), interpolation=InterpolationMode.BILINEAR, antialias=True, num_rand_calls=-1)[source]#
Crop a random portion of a batch of images and resize it to a given size.
The batch shape is expected to be [B, …, H, W], where … means an arbitrary number of dimensions
A crop of the original image is made: the crop has a random area (H * W) and a random aspect ratio. This crop is finally resized to the given size. This is popularly used to train the Inception networks.
- Parameters:
size (
Union[int,Sequence[int]]) –Expected output size of the crop, for each edge. If size is an int instead of sequence like (h, w), a square output size
(size, size)is made. If provided a sequence of length 1, it will be interpreted as (size[0], size[0]).Note
In torchscript mode size as single int is not supported, use a sequence of length 1:
[size, ].scale (
Sequence[float], optional) – Specifies the lower and upper bounds for the random area of the crop, before resizing. The scale is defined with respect to the area of the original image.Default:(0.08, 1.0)ratio (
Sequence[float], optional) – lower and upper bounds for the random aspect ratio of the crop, before resizing.Default:(0.75, 1.3333333333333333)interpolation (
InterpolationMode, 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. It only affects bilinear or bicubic modes and it is ignored otherwise.Default:Truenum_rand_calls (
int, optional) – Number of random calls performed to apply augmentations at different orders on sub-batches. If -1, B calls are performed. The maximum is 24 = 4!.