快捷方式

CocoDetection

class torchvision.datasets.CocoDetection(root: Union[str, Path], annFile: str, transform: Optional[Callable] = None, target_transform: Optional[Callable] = None, transforms: Optional[Callable] = None)[source]

MS Coco Detection 数据集。

需要安装 pycocotools,可通过 pip install pycocotoolsconda install conda-forge::pycocotools 进行安装。

参数:
  • root (str or pathlib.Path) – 图像下载到的根目录。

  • annFile (string) – json 标注文件的路径。

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

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

  • transforms (callable, optional) – 一个函数/变换,接受输入样本及其目标作为输入,并返回变换后的版本。

使用 CocoDetection 的示例

Transforms v2: 端到端对象检测/分割示例

Transforms v2: 端到端对象检测/分割示例

transforms v2 入门

transforms v2 入门
特殊成员:

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

index (int) – 索引

返回值:

样本和元数据,可选择由相应的变换进行变换。

返回类型:

(Any)

文档

查阅 PyTorch 的全面开发者文档

查看文档

教程

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

查看教程

资源

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

查看资源