extorch.vision.transforms.functional
- extorch.vision.transforms.functional.cutout(image: torch.Tensor, length: int, n_holes: int = 1) torch.Tensor [source]
Cutout: Randomly mask out one or more patches from an image (Link).
- Parameters
image (Tensor) – Image of size (C, H, W).
length (int) – The length (in pixels) of each square patch.
n_holes (int) – Number of patches to cut out of each image. Default: 1.
- Returns
Image with n_holes of dimension length x length cut out of it.
- Return type
image (Tensor)
- Examples::
>>> image = torch.ones((3, 32, 32)) >>> image = cutout(image, 16, 1)