快捷方式

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: A Simple Data Processing Method to Improve Robustness and Uncertainty” 的 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.NEARESTInterpolationMode.BILINEAR

  • fill (sequence or number, optional) – 轉換後圖像區域外的畫素填充值。如果給定一個數字,則該值將用於所有波段。

使用 AugMix 的示例

轉換圖示

轉換圖示
forward(orig_img: Tensor) Tensor[source]

img (PIL Image 或 Tensor):待轉換影像。

返回值:

轉換後的影像。

返回型別:

PIL Image 或 Tensor

文件

訪問 PyTorch 的完整開發者文件

檢視文件

教程

獲取面向初學者和高階開發者的深入教程

檢視教程

資源

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

檢視資源