AutoAugment¶
- class torchvision.transforms.AutoAugment(policy: AutoAugmentPolicy = AutoAugmentPolicy.IMAGENET, interpolation: InterpolationMode = InterpolationMode.NEAREST, fill: Optional[List[float]] = None)[source]¶
基於 “AutoAugment: Learning Augmentation Strategies from Data” 的 AutoAugment 資料擴增方法。如果圖片是 torch Tensor,則應為 torch.uint8 類型,並且預期具有 […, 1 或 3, H, W] 形狀,其中 … 表示任意數量的先導維度。如果 img 是 PIL Image,則預期處於 “L” 或 “RGB” 模式。
- 參數:
policy (AutoAugmentPolicy) – 由
torchvision.transforms.autoaugment.AutoAugmentPolicy
定義的所需策略列舉。預設值為AutoAugmentPolicy.IMAGENET
。interpolation(插值) (InterpolationMode) – 期望的插值枚舉,由
torchvision.transforms.InterpolationMode
定義。預設值為InterpolationMode.NEAREST
。如果輸入為 Tensor,則僅支援InterpolationMode.NEAREST
和InterpolationMode.BILINEAR
。fill(填充) (sequence 或 number, optional) – 轉換後影像外部區域的像素填充值。 如果給定一個數字,則該值分別用於所有通道。
使用
AutoAugment
的範例