快捷方式

Caltech101

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)[源代码]

Caltech 101 数据集。

警告

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

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

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

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

  • target_transform (可调用对象, 可选) – 一个函数/变换,接受目标并对其进行变换。

  • download (bool, 可选) –

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

    警告

    下载数据集需要 gdown

特殊成员:

__getitem__(index: int) tuple[Any, Any][源代码]
参数:

index (int) – 索引

返回:

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

返回类型:

元组

文档

访问全面的 PyTorch 开发者文档

查看文档

教程

为初学者和高级开发者提供深入的教程

查看教程

资源

查找开发资源并让您的问题得到解答

查看资源