快速鍵

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 資料集。

它需要安裝 COCO API

參數:
  • root (str 或 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) – 索引

回傳:

樣本和元數據,可選擇透過相應的 transforms 進行轉換。

回傳類型:

(Any)

文件

存取 PyTorch 的完整開發人員文件

檢視文件

教學課程

取得針對初學者和進階開發人員的深入教學課程

檢視教學課程

資源

尋找開發資源並獲得問題解答

檢視資源