快捷方式

RandAugment

class torchvision.transforms.v2.RandAugment(num_ops: int = 2, magnitude: int = 9, num_magnitude_bins: int = 31, interpolation: Union[InterpolationMode, int] = InterpolationMode.NEAREST, fill: Union[int, float, Sequence[int], Sequence[float], None, dict[Union[type, str], Union[int, float, collections.abc.Sequence[int], collections.abc.Sequence[float], NoneType]] = None)[原始碼]

基於 “RandAugment: Practical automated data augmentation with a reduced search space” 的 RandAugment 資料增強方法。

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

如果輸入是 torch.Tensor,則其型別應為 torch.uint8,並且期望其形狀為 […, 1 或 3, H, W],其中 … 表示任意數量的前導維度。如果 img 是 PIL Image,則期望其模式為“L”或“RGB”。

引數:
  • num_ops (int, optional) – 連續應用的增強變換的數量,必須是非負整數。預設值:2。

  • magnitude (int, optional) – 所有變換的幅度。

  • num_magnitude_bins (int, optional) – 不同幅度值的數量。

  • interpolation (InterpolationMode, optional) – 由 torchvision.transforms.InterpolationMode 定義的期望的插值列舉。預設為 InterpolationMode.NEAREST。如果輸入是 Tensor,則只支援 InterpolationMode.NEARESTInterpolationMode.BILINEAR

  • fill (sequencenumber, 可選) – 轉換後圖像外部區域的畫素填充值。如果給定一個數字,則該值分別用於所有通道。

使用 RandAugment 的示例

轉換圖示

轉換圖示
forward(*inputs: Any) Any[原始碼]

不要覆蓋此方法!請使用 transform() 代替。

文件

訪問全面的 PyTorch 開發者文件

檢視文件

教程

為初學者和高階開發者提供深入的教程

檢視教程

資源

查詢開發資源並讓您的問題得到解答

檢視資源