Shortcuts

TrivialAugmentWide

class torchvision.transforms.TrivialAugmentWide(num_magnitude_bins: int = 31, interpolation: InterpolationMode = InterpolationMode.NEAREST, fill: Optional[List[float]] = None)[source]

使用TrivialAugment Wide进行与数据集无关的数据增强,如“TrivialAugment: Tuning-free Yet State-of-the-Art Data Augmentation”中所述。 如果图像是torch张量,它应该是torch.uint8类型,并且期望具有[…, 1或3, H, W]形状,其中…表示任意数量的前导维度。 如果img是PIL图像,则期望其模式为“L”或“RGB”。

Parameters:
  • num_magnitude_bins (int) – 不同幅度值的数量。

  • 插值 (InterpolationMode) – 由torchvision.transforms.InterpolationMode定义的期望插值枚举。默认是InterpolationMode.NEAREST。如果输入是张量,仅支持InterpolationMode.NEARESTInterpolationMode.BILINEAR

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

使用TrivialAugmentWide的示例:

变换的图示

Illustration of transforms
forward(img: Tensor) Tensor[source]

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

Returns:

转换后的图像。

Return type:

PIL 图像或张量