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)[source]¶
RandAugment 資料擴充方法基於 “RandAugment: Practical automated data augmentation with a reduced search space”。如果影像是 torch Tensor,則應為 torch.uint8 類型,並且預期具有 […, 1 或 3, H, W] 形狀,其中 … 表示任意數量的領先維度。如果 img 是 PIL 影像,則預期為 “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, optional) – 轉換後圖像外部區域的像素填充值。如果給定一個數字,則該值將分別用於所有通道。
使用
RandAugment
的範例