SVHN¶
- class torchvision.datasets.SVHN(root: Union[str, Path], split: str = 'train', transform: Optional[Callable] = None, target_transform: Optional[Callable] = None, download: bool = False)[source]¶
SVHN 数据集。注意:SVHN 数据集将标签 10 分配给数字 0。但是,在此数据集中,我们将标签 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 (callable, optional) – 接收目标并对其进行转换的功能/转换。
download (bool, optional) – 如果为 true,则从互联网下载数据集并将其放入根目录。如果数据集已下载,则不会再次下载。
- 特殊成员: