快捷方式

AutoAugment

class torchvision.transforms.v2.AutoAugment(policy: AutoAugmentPolicy = AutoAugmentPolicy.IMAGENET, interpolation: Union[InterpolationMode, int] = InterpolationMode.NEAREST, fill: Union[int, float, Sequence[int], Sequence[float], None, Dict[Union[Type, str], Optional[Union[int, float, Sequence[int], Sequence[float]]]]] = None)[source]

基於 “AutoAugment: Learning Augmentation Strategies from Data” 的 AutoAugment 資料擴增方法。

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

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

參數:
  • policy (AutoAugmentPolicy, optional) – 期望的策略枚舉,由 torchvision.transforms.autoaugment.AutoAugmentPolicy 定義。 預設值為 AutoAugmentPolicy.IMAGENET

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

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

使用 AutoAugment 的範例

轉換的說明

轉換的說明
forward(*inputs: Any) Any[source]

不要覆寫它!請改用 transform()

static get_params(transform_num: int) Tuple[int, Tensor, Tensor][source]

取得 autoaugment 轉換的參數

回傳:

autoaugment 轉換所需的參數

文件

存取 PyTorch 的全面開發人員文件

檢視文件

教學課程

取得初學者和進階開發人員的深入教學課程

檢視教學課程

資源

尋找開發資源並取得問題解答

檢視資源