SVHN¶
- class torchvision.datasets.SVHN(root: Union[str, Path], split: str = 'train', transform: Optional[Callable] = None, target_transform: Optional[Callable] = None, download: bool = False)[源代码]¶
SVHN 数据集。注意:SVHN 数据集将数字 0 的标签分配为 10。然而,在这个数据集中,我们将数字 0 的标签分配为 0,以兼容 PyTorch 期望类别标签在 [0, C-1] 范围内的损失函数。
警告
此类需要 scipy 来从 .mat 格式加载数据。
- 参数:
root (str 或
pathlib.Path
) – 数据集根目录,数据存储在此处。split (string) – {‘train’, ‘test’, ‘extra’} 中的一个。相应地选择数据集。‘extra’ 是额外的训练集。
transform (callable, optional) – 一个函数/转换,它接收 PIL 图像并返回转换后的版本。例如,
transforms.RandomCrop
target_transform (可调用对象, 可选) – 一个函数/变换,接受目标并对其进行变换。
download (bool, optional) – 如果为 True,则从互联网下载数据集并将其放入根目录。如果数据集已下载,则不会再次下载。
- 特殊成员: