捷徑

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], Optional[Union[int, float]]]]] = None)[source]

基於 "RandAugment: Practical automated data augmentation with a reduced search space" 的 RandAugment 數據增強方法。

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

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

參數:
  • num_ops (int, optional) – 依序套用的增強轉換次數。

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

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

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

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

使用 RandAugment 的範例

轉換的說明

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

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

文件

存取 PyTorch 的完整開發者文件

檢視文件

教學

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

檢視教學

資源

尋找開發資源並獲得您的問題解答

檢視資源