RandomErasing¶
- class torchvision.transforms.v2.RandomErasing(p: float = 0.5, scale: Sequence[float] = (0.02, 0.33), ratio: Sequence[float] = (0.3, 3.3), value: float = 0.0, inplace: bool = False)[原始碼]¶
隨機選擇輸入影像或影片中的一個矩形區域並擦除其畫素。
此變換不支援 PIL Image。Zhong 等人的“隨機擦除資料增強”。請參閱 https://arxiv.org/abs/1708.04896
- 引數:
- 返回:
擦除後的輸入。
示例
>>> from torchvision.transforms import v2 as transforms >>> >>> transform = transforms.Compose([ >>> transforms.RandomHorizontalFlip(), >>> transforms.PILToTensor(), >>> transforms.ConvertImageDtype(torch.float), >>> transforms.Normalize((0.485, 0.456, 0.406), (0.229, 0.224, 0.225)), >>> transforms.RandomErasing(), >>> ])