快捷方式

STL10

class torchvision.datasets.STL10(root: Union[str, Path], split: str = 'train', folds: Optional[int] = None, transform: Optional[Callable] = None, target_transform: Optional[Callable] = None, download: bool = False)[source]

STL10 数据集。

参数:
  • root (str 或 pathlib.Path) – 数据集的根目录,其中存在目录 stl10_binary

  • split (字符串) – 以下选项之一:{'train', 'test', 'unlabeled', 'train+unlabeled'}。根据此选项选择数据集。

  • folds (int, 可选) – 以下选项之一:{0-9} 或 None。对于训练,加载标准评估过程中 10 个预定义折叠(每个折叠 1k 样本)中的一个。如果未传递值,则加载 5k 样本。

  • transform (callable, 可选) – 一个函数/变换,接收 PIL 图像并返回变换后的版本。例如,transforms.RandomCrop

  • target_transform (callable, 可选) – 一个函数/变换,接收目标并对其进行变换。

  • download (bool, 可选) – 如果为 true,则从互联网下载数据集并将其放在根目录中。如果数据集已下载,则不再重复下载。

特殊成员:

__getitem__(index: int) Tuple[Any, Any][source]
参数:

index (int) – 索引

返回:

(image, target),其中 target 是目标类别的索引。

返回类型:

tuple

文档

获取 PyTorch 全面的开发者文档

查看文档

教程

获取面向初学者和高级开发者的深度教程

查看教程

资源

查找开发资源并获得问题解答

查看资源