extorch.vision.transforms
¶
- class extorch.vision.transforms.Cutout(length: int, n_holes: int = 1)[source]¶
Bases:
torch.nn.modules.module.Module
Cutout: Randomly mask out one or more patches from an image (Link).
- Parameters
length (int) – The length (in pixels) of each square patch.
image (Tensor) – Image of size (C, H, W).
n_holes (int) – Number of patches to cut out of each image. Default: 1.
- Examples::
>>> image = torch.ones((3, 32, 32)) >>> Cutout_transform = Cutout(16, 1) >>> image = Cutout_transform(image) # Shape: [3, 32, 32]
- forward(img: torch.Tensor) torch.Tensor [source]¶
- Parameters
img (Tensor) – Image of size (C, H, W).
- Returns
Image with n_holes of dimension length x length cut out of it.
- Return type
img (Tensor)
- training: bool¶