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)[原始碼]¶
大規模 CelebFaces 屬性 (CelebA) 資料集 資料集。
- 引數:
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.PILToTensortarget_transform (可呼叫物件, 可選) – 一個函式/變換,接受目標並對其進行變換。
download (bool, optional) –
如果為 true,則從網際網路下載資料集並將其放入根目錄。如果資料集已下載,則不再下載。
警告
下載資料集需要 gdown。
- 特殊成員: