Shortcuts

加州理工学院101

class torchvision.datasets.Caltech101(root: Union[str, Path], target_type: Union[List[str], str] = 'category', transform: Optional[Callable] = None, target_transform: Optional[Callable] = None, download: bool = False)[source]

Caltech 101 数据集。

警告

这个类需要scipy来从.mat格式加载目标文件。

Parameters:
  • root (str 或 pathlib.Path) – 数据集的根目录,其中目录 caltech101 存在或将保存到,如果 download 设置为 True。

  • target_type (stringlist, 可选) – 使用的目标类型,categoryannotation。也可以是一个列表,以输出包含所有指定 目标类型的元组。category 表示目标类别,而 annotation 是手绘轮廓的点列表。 默认为 category

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

  • target_transform (callable, optional) – 一个函数/转换,它接收目标并对其进行转换。

  • 下载 (bool, 可选) –

    如果为真,则从互联网下载数据集并将其放入根目录。如果数据集已经下载,则不会再次下载。

    警告

    要下载数据集,需要gdown

Special-members:

__getitem__(index: int) Tuple[Any, Any][source]
Parameters:

index (int) – 索引

Returns:

(image, target) 其中 target 的类型由 target_type 指定。

Return type:

tuple