RandAugment¶
- class torchvision.transforms.RandAugment(num_ops: int = 2, magnitude: int = 9, num_magnitude_bins: int = 31, interpolation: InterpolationMode = InterpolationMode.NEAREST, fill: Optional[list[float]] = None)[原始碼]¶
RandAugment 資料增強方法,基於 “RandAugment: Practical automated data augmentation with a reduced search space”。如果影像是 torch Tensor,它應該為 torch.uint8 型別,並且形狀應為 […, 1 或 3, H, W],其中 … 表示任意數量的前導維度。如果 img 是 PIL Image,則它應該為 “L” 或 “RGB” 模式。
- 引數:
num_ops (int) – 要連續應用的增強變換的數量。
magnitude (int) – 所有變換的幅度。
num_magnitude_bins (int) – 不同幅度值的數量。
interpolation (InterpolationMode) – 由
torchvision.transforms.InterpolationMode定義的期望插值列舉。預設為InterpolationMode.NEAREST。如果輸入是 Tensor,則僅支援InterpolationMode.NEAREST和InterpolationMode.BILINEAR。fill (sequence 或 number, 可選) – 轉換後圖像外部區域的畫素填充值。如果給定一個數字,則該值分別用於所有通道。
使用
RandAugment的示例