AugMix¶
- class torchvision.transforms.AugMix(severity: int = 3, mixture_width: int = 3, chain_depth: int = - 1, alpha: float = 1.0, all_ops: bool = True, interpolation: InterpolationMode = InterpolationMode.BILINEAR, fill: Optional[List[float]] = None)[source]¶
基于 “AugMix: 一种用于提高鲁棒性和不确定性的简单数据处理方法” 的 AugMix 数据增强方法。如果图像是 torch Tensor,则其类型应为 torch.uint8,并且应具有 […, 1 或 3, H, W] 形状,其中 … 表示任意数量的前导维度。如果 img 是 PIL Image,则应处于 “L” 或 “RGB” 模式。
- 参数:
severity (int) – 基础增强算子的强度。默认为
3
。mixture_width (int) – 增强链的数量。默认为
3
。chain_depth (int) – 增强链的深度。负值表示从区间 [1, 3] 中采样的随机深度。默认为
-1
。alpha (float) – 概率分布的超参数。默认为
1.0
。all_ops (bool) – 使用所有操作(包括亮度、对比度、颜色和锐度)。默认为
True
。interpolation (InterpolationMode) –
torchvision.transforms.InterpolationMode
定义的所需插值枚举。默认为InterpolationMode.NEAREST
。如果输入是 Tensor,则仅支持InterpolationMode.NEAREST
、InterpolationMode.BILINEAR
。fill (sequence 或 number, optional) – 变换后图像外部区域的像素填充值。如果给定一个数字,则该值分别用于所有波段。
使用
AugMix
的示例