five_crop¶
-
torchvision.transforms.functional.
five_crop
(img: torch.Tensor, size: List[int]) → Tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor][source]¶ Crop the given image into four corners and the central crop. If the image is torch Tensor, it is expected to have […, H, W] shape, where … means an arbitrary number of leading dimensions
Note
This transform returns a tuple of images and there may be a mismatch in the number of inputs and targets your
Dataset
returns.- Parameters
img (PIL Image or Tensor) – Image to be cropped.
size (sequence or int) – Desired output size of the crop. If size is an int instead of sequence like (h, w), a square crop (size, size) is made. If provided a sequence of length 1, it will be interpreted as (size[0], size[0]).
- Returns
tuple (tl, tr, bl, br, center) Corresponding top left, top right, bottom left, bottom right and center crop.
- Return type
Examples using
five_crop
: