快捷方式

StanfordCars

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

Stanford Cars 数据集

Cars 数据集包含 196 个汽车类别的 16,185 张图像。数据分为 8,144 张训练图像和 8,041 张测试图像,其中每个类别都大致分为 50-50。

原始 URL 是 https://ai.stanford.edu/~jkrause/cars/car_dataset.html,但已损坏。请按照 download 参数中的说明离线获取和使用数据集。

注意

此类需要 scipy 以从 .mat 格式加载目标文件。

参数:
  • root (str 或 pathlib.Path) – 数据集的根目录

  • split (string, optional) – 数据集拆分,支持 "train" (默认) 或 "test"

  • transform (callable, optional) – 接收 PIL 图像并返回转换后版本的功能/转换。例如,transforms.RandomCrop

  • target_transform (callable, optional) – 接收目标并对其进行转换的功能/转换。

  • download (bool, optional) – 此参数是为了向后兼容而存在的,但它不会下载数据集,因为原始 URL 不再可用。数据集似乎在 Kaggle 上可用,因此您可以尝试手动下载并使用 这些说明 配置它,或者使用 Kaggle 上的集成 数据集。在这两种情况下,请先在本地下载并配置数据集,然后使用 "download=False" 使用数据集。

特殊成员:

__getitem__(idx: int) Tuple[Any, Any][source]

返回给定索引的 pil_image 和 class_id

文档

访问 PyTorch 的全面开发者文档

查看文档

教程

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

查看教程

资源

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

查看资源