快捷方式

AutoAugment

torchvision.transforms.AutoAugment(policy: AutoAugmentPolicy = AutoAugmentPolicy.IMAGENET, interpolation: InterpolationMode = InterpolationMode.NEAREST, fill: Optional[List[float]] = None)[source]

基於 “AutoAugment: Learning Augmentation Strategies from Data” 的 AutoAugment 資料增強方法。如果影像是 torch Tensor,它應該是 torch.uint8 型別,並且期望具有 […, 1 或 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.NEAREST, InterpolationMode.BILINEAR

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

使用 AutoAugment 的示例

變換示意圖

變換示意圖
forward(img: Tensor) Tensor[source]

img (PIL Image 或 Tensor): 要變換的影像。

返回值:

經過 AutoAugment 增強的影像。

返回型別:

PIL Image 或 Tensor

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

獲取 AutoAugment 變換的引數

返回值:

AutoAugment 變換所需的引數

文件

訪問 PyTorch 的完整開發者文件

檢視文件

教程

獲取適合初學者和高階開發者的深入教程

檢視教程

資源

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

檢視資源