快捷方式

VOCDetection

class torchvision.datasets.VOCDetection(root: Union[str, Path], year: str = '2012', image_set: str = 'train', download: bool = False, transform: Optional[Callable] = None, target_transform: Optional[Callable] = None, transforms: Optional[Callable] = None)[源]

Pascal VOC 檢測資料集。

引數:
  • root (str 或 pathlib.Path) – VOC 資料集的根目錄。

  • year (字串, 可選) – 資料集年份,支援年份 "2007""2012"

  • image_set (字串, 可選) – 選擇要使用的 image_set,"train""trainval""val"。如果 year=="2007",也可以是 "test"

  • download (bool, 可選) – 如果為 True,則從網際網路下載資料集並將其放在根目錄中。如果資料集已下載,則不會再次下載。(預設:VOC 20 個類別的字母索引)。

  • transform (可呼叫物件, 可選) – 一個函式/變換,接收 PIL 影像並返回變換後的版本。例如,transforms.RandomCrop

  • target_transform (可呼叫物件, 必需) – 一個函式/變換,接收目標並對其進行變換。

  • transforms (可呼叫物件, 可選) – 一個函式/變換,將輸入樣本及其目標作為輸入並返回變換後的版本。

特殊成員:

__getitem__(index: int) Tuple[Any, Any][源]
引數:

index (int) – 索引

返回值:

(image, target),其中 target 是 XML 樹的字典表示。

返回型別:

tuple

文件

訪問 PyTorch 的全面開發者文件

檢視文件

教程

獲取面向初學者和高階開發者的深度教程

檢視教程

資源

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

檢視資源