快捷方式

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)[原始碼]

AutoAugment 資料增強方法,基於 “AutoAugment: Learning Augmentation Strategies from Data”

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

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

引數:
  • policy (AutoAugmentPolicy, 可選) – 期望的策略列舉,由 torchvision.transforms.autoaugment.AutoAugmentPolicy 定義。預設為 AutoAugmentPolicy.IMAGENET

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

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

使用 AutoAugment 的示例

變換圖示

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

不要重寫此方法!請改用 transform()

static get_params(transform_num: int) Tuple[int, Tensor, Tensor][原始碼]

獲取 AutoAugment 變換的引數

返回值:

AutoAugment 變換所需的引數

文件

查閱 PyTorch 的全面開發者文件

檢視文件

教程

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

檢視教程

資源

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

檢視資源