快捷方式

AutoAugment

class torchvision.transforms.AutoAugment(policy: AutoAugmentPolicy = AutoAugmentPolicy.IMAGENET, interpolation: InterpolationMode = InterpolationMode.NEAREST, fill: Optional[list[float]] = None)[源代码]

AutoAugment 数据增强方法,基于 “AutoAugment: Learning Augmentation Strategies from Data”。如果图像是 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.NEARESTInterpolationMode.BILINEAR

  • fill (sequencenumber, 可选) – 转换后图像外部区域的像素填充值。如果给定一个数字,则该值分别用于所有通道。

使用 AutoAugment 的示例

转换图示

转换图示
forward(img: Tensor) Tensor[源代码]

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

返回:

AutoAugmented 图像。

返回类型:

PIL 图像或张量

static get_params(transform_num: int) tuple[int, torch.Tensor, torch.Tensor][源代码]

获取 autoaugment 转换的参数

返回:

autoaugment 转换所需的参数

文档

访问全面的 PyTorch 开发者文档

查看文档

教程

为初学者和高级开发者提供深入的教程

查看教程

资源

查找开发资源并让您的问题得到解答

查看资源