快捷方式

QMNIST

class torchvision.datasets.QMNIST(root: Union[str, Path], what: Optional[str] = None, compat: bool = True, train: bool = True, **kwargs: Any)[源代码]

QMNIST 数据集。

参数:
  • root (str 或 pathlib.Path) – 数据集的根目录,其 raw 子目录包含数据集的二进制文件。

  • what (string,optional) – 可以是 ‘train’, ‘test’, ‘test10k’, ‘test50k’, 或 ‘nist’,分别对应于与 MNIST 兼容的训练集、60k 的 QMNIST 测试集、匹配 MNIST 测试集的 10k QMNIST 示例、剩余的 50k QMNIST 测试示例,或所有 NIST 数字。默认是根据兼容性参数 ‘train’ 选择 ‘train’ 或 ‘test’。

  • compat (bool,optional) – 一个布尔值,指示每个示例的目标是类号(为了与 MNIST 数据加载器兼容)还是包含完整 QMNIST 信息的 torch 向量。默认为 True。

  • train (bool,optional,compatibility) – 当未指定 ‘what’ 参数时,此布尔值决定加载训练集还是测试集。默认为:True。

  • download (bool, optional) – 如果为 True,则从互联网下载数据集并将其放入根目录。如果数据集已下载,则不会再次下载。

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

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

特殊成员:

__getitem__(index: int) tuple[Any, Any][源代码]
参数:

index (int) – 索引

返回:

(图像, 目标) 其中目标是目标类的索引。

返回类型:

元组

文档

访问全面的 PyTorch 开发者文档

查看文档

教程

为初学者和高级开发者提供深入的教程

查看教程

资源

查找开发资源并让您的问题得到解答

查看资源