StanfordCars¶
- class torchvision.datasets.StanfordCars(root: ~typing.Union[str, ~pathlib.Path], split: str = 'train', transform: ~typing.Optional[~typing.Callable] = None, target_transform: ~typing.Optional[~typing.Callable] = None, download: bool = False, loader: ~typing.Callable[[str], ~typing.Any] = <function default_loader>)[源代码]¶
Stanford Cars 数据集
Cars 数据集包含 16,185 张图像,共 196 类汽车。数据被分为 8,144 张训练图像和 8,041 张测试图像,其中每个类别大致以 50-50 的比例划分。
原始 URL 是 https://ai.stanford.edu/~jkrause/cars/car_dataset.html,但该数据集已不再在线可用。
注意
此类需要 scipy 来加载 .mat 格式的目标文件。
- 参数:
root (str 或
pathlib.Path
) – 数据集根目录split (string, optional) – 数据集分割,支持
"train"
(默认)或"test"
。transform (callable, optional) – 一个函数/转换,接受 PIL 图像或 torch.Tensor(取决于给定的加载器),并返回转换后的版本。例如
transforms.RandomCrop
target_transform (callable, optional) – 一个函数/转换,接受目标并对其进行转换。
download (bool, optional) – 此参数用于向后兼容,但它不会下载数据集,因为原始 URL 已不再可用。
loader (callable, optional) – 给定图像路径的加载函数。默认使用 PIL 作为图像加载器,但用户也可以传入
torchvision.io.decode_image
以将图像数据直接解码为张量。
- 特殊成员: