快捷方式

AutoAugment

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** (序列数字, 可选) – 变换后图像区域外的像素填充值。如果给定一个数字,该值将分别用于所有波段。

使用 AutoAugment 的示例

变换示意图

变换示意图
forward(img: Tensor) Tensor[source]

img (PIL Image 或 Tensor): 要变换的图像。

返回值:

经过 AutoAugment 增强的图像。

返回类型:

PIL Image 或 Tensor

静态 get_params(transform_num: int) Tuple[int, Tensor, Tensor][source]

获取 AutoAugment 变换的参数

返回值:

AutoAugment 变换所需的参数

文档

访问 PyTorch 的完整开发者文档

查看文档

教程

获取适合初学者和高级开发者的深入教程

查看教程

资源

查找开发资源并获得问题解答

查看资源