快捷方式

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 的全面開發者文件

檢視文件

教程

為初學者和高階開發者提供深度教程

檢視教程

資源

查詢開發資源並獲得問題解答

檢視資源