RandAugment¶
- class torchvision.transforms.v2.RandAugment(num_ops: int = 2, magnitude: int = 9, num_magnitude_bins: int = 31, interpolation: Union[InterpolationMode, int] = InterpolationMode.NEAREST, fill: Union[int, float, Sequence[int], Sequence[float], None, Dict[Union[Type, str], Optional[Union[int, float, Sequence[int], Sequence[float]]]]] = None)[source]¶
基於“RandAugment: Practical automated data augmentation with a reduced search space”的 RandAugment 資料增強方法。
此變換僅適用於影像和影片。
如果輸入是
torch.Tensor,其型別應為torch.uint8,且預期形狀為 […, 1 or 3, H, W],其中 … 表示任意數量的前導維度。如果輸入是 PIL Image,則預期模式為 “L” 或 “RGB”。- 引數:
num_ops (int, optional) – 依次應用的增強變換數量,必須是非負整數。預設值:2。
magnitude (int, optional) – 所有變換的幅度。
num_magnitude_bins (int, optional) – 不同幅度的值的數量。
interpolation (InterpolationMode, optional) – 由
torchvision.transforms.InterpolationMode定義的所需插值列舉。預設值為InterpolationMode.NEAREST。如果輸入是 Tensor,僅支援InterpolationMode.NEAREST和InterpolationMode.BILINEAR。fill (sequence or number, optional) – 變換後圖像外部區域的畫素填充值。如果給出一個數字,該值將分別用於所有通道。
使用
RandAugment的示例