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 pycocotools或conda install conda-forge::pycocotools進行安裝。- 引數:
root (str or
pathlib.Path) – 影像下載到的根目錄。annFile (string) – json 標註檔案的路徑。
transform (callable, optional) – 一個函式/變換,接受 PIL 影像並返回變換後的版本。例如,
transforms.PILToTensortarget_transform (callable, optional) – 一個函式/變換,接受目標並對其進行變換。
transforms (callable, optional) – 一個函式/變換,接受輸入樣本及其目標作為輸入,並返回變換後的版本。
使用
CocoDetection的示例- 特殊成員: