快捷方式

AugMix

class torchvision.transforms.v2.AugMix(severity: int = 3, mixture_width: int = 3, chain_depth: int = - 1, alpha: float = 1.0, all_ops: bool = True, interpolation: Union[InterpolationMode, int] = InterpolationMode.BILINEAR, fill: Union[int, float, Sequence[int], Sequence[float], None, Dict[Union[Type, str], Optional[Union[int, float, Sequence[int], Sequence[float]]]]] = None)[source]

基於“AugMix: 一種提升魯棒性和不確定性的簡單資料處理方法”的 AugMix 資料增強方法。

此變換僅適用於影像和影片。

如果輸入是torch.Tensor,其型別應為torch.uint8,並且期望形狀為 […, 1 or 3, H, W],其中 … 表示任意數量的前導維度。如果輸入是 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.NEARESTInterpolationMode.BILINEAR

  • fill (序列數字, 可選) – 變換後圖像區域外的畫素填充值。如果給定一個數字,該值將分別用於所有波段。

使用 AugMix 的示例

變換圖解

變換圖解
forward(*inputs: Any) Any[source]

請勿覆蓋此方法!請改用 transform() 方法。

文件

訪問 PyTorch 的完整開發者文件

檢視文件

教程

獲取針對初學者和高階開發者的深入教程

檢視教程

資源

查詢開發資源並獲得問題解答

檢視資源