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)[source]¶
Large-scale CelebFaces Attributes (CelebA) Dataset 数据集。
- Parameters:
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, 宽度, 高度)landmarks(Tensor shape=(10,) dtype=int): 地标点 (左眼_x, 左眼_y, 右眼_x, 右眼_y, 鼻子_x, 鼻子_y, 左嘴_x, 左嘴_y, 右嘴_x, 右嘴_y)
默认为
attr。如果为空,None将作为目标返回。transform (callable, optional) – 一个函数/变换,接收一个PIL图像并返回一个变换后的版本。例如,
transforms.PILToTensortarget_transform (callable, optional) – 一个函数/转换,它接收目标并对其进行转换。
下载 (bool, 可选) –
如果为真,则从互联网下载数据集并将其放入根目录。如果数据集已经下载,则不会再次下载。
警告
要下载数据集,需要gdown。
- Special-members: