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)[原始碼]¶
-
- 引數:
root (str 或
pathlib.Path) – 圖片下載到的根目錄。split (string) – {‘train’, ‘valid’, ‘test’, ‘all’} 之一。據此選擇資料集。
target_type (string 或 list, 可選) –
要使用的目標型別,
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, 可選) – 一個函式/變換,接受 PIL 影像並返回變換後的版本。例如,
transforms.PILToTensortarget_transform (callable, 可選) – 一個函式/變換,接受目標並對其進行變換。
download (bool, 可選) –
如果為 True,則從網際網路下載資料集並將其放入根目錄。如果資料集已下載,則不會再次下載。
警告
下載資料集需要 gdown。
- 特殊成員: