快捷方式

FakeData

class torchvision.datasets.FakeData(size: int = 1000, image_size: Tuple[int, int, int] = (3, 224, 224), num_classes: int = 10, transform: Optional[Callable] = None, target_transform: Optional[Callable] = None, random_offset: int = 0)[source]

一個返回隨機生成影像的假資料集,並將其作為 PIL 影像返回

引數:
  • size (int, optional) – 資料集的大小。預設為 1000 張影像

  • image_size (tuple, optional) – 返回影像的大小。預設為 (3, 224, 224)

  • num_classes (int, optional) – 資料集中的類別數量。預設為 10

  • transform (callable, optional) – 一個函式/變換,接收 PIL 影像並返回變換後的版本。例如,transforms.RandomCrop

  • target_transform (callable, optional) – 一個函式/變換,接收目標並對其進行變換。

  • random_offset (int) – 用於生成每張影像的基於索引的隨機種子的偏移量。預設為 0

使用 FakeData 的示例

如何使用 CutMix 和 MixUp

如何使用 CutMix 和 MixUp
特殊成員:

__getitem__(index: int) Tuple[Any, Any][source]
引數:

index (int) – 索引

返回值:

(image, target),其中 target 是目標類別的 class_index。

返回型別:

tuple

文件

訪問 PyTorch 的全面開發者文件

檢視文件

教程

獲取針對初學者和高階開發者的深入教程

檢視教程

資源

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

檢視資源