CelebA¶
- class torchvision.datasets.CelebA(root: Union[str, Path], split: str = 'train', target_type: Union[List[str], str] = 'attr', transform: Optional[Callable] = None, target_transform: Optional[Callable] = None, download: bool = False)[原始碼]¶
Large-scale CelebFaces Attributes (CelebA) Dataset 資料集。
- 參數:
root (str 或
pathlib.Path
) – 圖片下載後的根目錄。split (string) – 從 {‘train’, ‘valid’, ‘test’, ‘all’} 中擇一。根據所選項目選擇資料集。
target_type (string 或 list, optional) –
要使用的目標類型,
attr
,identity
,bbox
, 或landmarks
。 也可以是一個列表,以輸出包含所有指定目標類型的元組。 這些目標代表attr
(Tensor shape=(40,) dtype=int): 屬性的二元 (0, 1) 標籤identity
(int): 每個人的標籤(具有相同身份的資料點是同一個人)bbox
(Tensor shape=(4,) dtype=int): 邊界框 (x, y, width, height)landmarks
(Tensor shape=(10,) dtype=int): 地標點 (lefteye_x, lefteye_y, righteye_x, righteye_y, nose_x, nose_y, leftmouth_x, leftmouth_y, rightmouth_x, rightmouth_y)
預設為
attr
。 如果為空,則將返回None
作為目標。transform (callable, optional) – 接收 PIL 圖像並返回轉換版本的函式/轉換。 例如,
transforms.PILToTensor
target_transform (callable, optional) – 接收目標並轉換它的函式/轉換。
download (bool, optional) –
如果為 true,則從網際網路下載資料集並將其放入根目錄。 如果已下載資料集,則不會再次下載。
警告
要下載資料集,需要 gdown。
- 特殊成員: