TenCrop — Torchvision 0.22 documentation (original) (raw)

class torchvision.transforms.v2.TenCrop(size: Union[int, Sequence[int]], vertical_flip: bool = False)[source]

Crop the image or video into four corners and the central crop plus the flipped version of these (horizontal flipping is used by default).

If the input is a torch.Tensor or a Image or aVideo it can have arbitrary number of leading batch dimensions. For example, the image can have [..., C, H, W] shape.

See FiveCrop for an example.

Note

This transform returns a tuple of images and there may be a mismatch in the number of inputs and targets your Dataset returns. See below for an example of how to deal with this.

Parameters:

transform(inpt: Any, params: Dict[str, Any]) → Any[source]

Method to override for custom transforms.

See How to write your own v2 transforms