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, 可选) –
要使用的目标类型,“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.PILToTensor
target_transform (可调用对象, 可选) – 一个函数/变换,接受目标并对其进行变换。
download (bool, 可选) –
如果为 true,则从互联网下载数据集并将其放入根目录。如果数据集已下载,则不再下载。
警告
下载数据集需要 gdown。
- 特殊成员: