AutoAugment¶
- class torchvision.transforms.v2.AutoAugment(policy: AutoAugmentPolicy = AutoAugmentPolicy.IMAGENET, 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)[原始碼]¶
AutoAugment 資料增強方法,基於 “AutoAugment: Learning Augmentation Strategies from Data”。
此變換僅適用於影像和影片。
如果輸入是
torch.Tensor,其型別應為torch.uint8,且期望形狀為 […, 1 or 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 (序列 或 數字, 可選) – 變換影像外部區域的畫素填充值。如果給定一個數字,則該值將分別用於所有波段。
使用
AutoAugment的示例