自动增强¶
- 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张量,它应该是torch.uint8类型,并且期望具有[…, 1或3, H, W]形状,其中…表示任意数量的前导维度。如果img是PIL图像,则期望其模式为“L”或“RGB”。
- Parameters:
policy (AutoAugmentPolicy) – 由
torchvision.transforms.autoaugment.AutoAugmentPolicy定义的期望策略枚举。默认值为AutoAugmentPolicy.IMAGENET。插值 (InterpolationMode) – 由
torchvision.transforms.InterpolationMode定义的期望插值枚举。默认是InterpolationMode.NEAREST。如果输入是张量,仅支持InterpolationMode.NEAREST和InterpolationMode.BILINEAR。fill (sequence 或 number, 可选) – 用于变换图像外部区域的像素填充值。如果给定一个数字,则该值将分别用于所有波段。
使用
AutoAugment的示例: