Vision dataset#
CelebA#
Class to describe attributes of the CelebA dataset.
- CELEBA_BASE_FOLDER: Final = 'celeba'#
The data is downloaded to download_dir / CELEBA_BASE_FOLDER.
- CELEBA_FILE_LIST: Final = [('1zmsC4yvw-e089uHXj5EdP0BSZ0AlDQRR', '00d2c5bc6d35e252742224ab0c1e8fcb', 'img_align_celeba.zip'), ('1gxmFoeEPgF9sT65Wpo85AnHl3zsQ4NvS', '75e246fa4810816ffd6ee81facbd244c', 'list_attr_celeba.txt'), ('1ih_VMokoI774ErNWrb26lDeWlanUBpnX', 'd32c9cbf5e040fd4025c592c306e6668', 'list_eval_partition.txt')]#
Google drive IDs, MD5 hashes and filenames for the CelebA files.
- class CelebA(discrete_only=False, invert_s=False, label='Smiling', sens_attr='Male')#
Bases:
ethicml.data.dataset.LoadableDataset
CelebA dataset.
- Parameters
discrete_only (bool) –
invert_s (bool) –
label (Literal['5_o_Clock_Shadow', 'Arched_Eyebrows', 'Attractive', 'Bags_Under_Eyes', 'Bald', 'Bangs', 'Big_Lips', 'Big_Nose', 'Black_Hair', 'Blond_Hair', 'Blurry', 'Brown_Hair', 'Bushy_Eyebrows', 'Chubby', 'Double_Chin', 'Eyeglasses', 'Goatee', 'Gray_Hair', 'Heavy_Makeup', 'High_Cheekbones', 'Male', 'Mouth_Slightly_Open', 'Mustache', 'Narrow_Eyes', 'No_Beard', 'Oval_Face', 'Pale_Skin', 'Pointy_Nose', 'Receding_Hairline', 'Rosy_Cheeks', 'Sideburns', 'Smiling', 'Straight_Hair', 'Wavy_Hair', 'Wearing_Earrings', 'Wearing_Hat', 'Wearing_Lipstick', 'Wearing_Necklace', 'Wearing_Necktie', 'Young']) –
sens_attr (Union[Literal['5_o_Clock_Shadow', 'Arched_Eyebrows', 'Attractive', 'Bags_Under_Eyes', 'Bald', 'Bangs', 'Big_Lips', 'Big_Nose', 'Black_Hair', 'Blond_Hair', 'Blurry', 'Brown_Hair', 'Bushy_Eyebrows', 'Chubby', 'Double_Chin', 'Eyeglasses', 'Goatee', 'Gray_Hair', 'Heavy_Makeup', 'High_Cheekbones', 'Male', 'Mouth_Slightly_Open', 'Mustache', 'Narrow_Eyes', 'No_Beard', 'Oval_Face', 'Pale_Skin', 'Pointy_Nose', 'Receding_Hairline', 'Rosy_Cheeks', 'Sideburns', 'Smiling', 'Straight_Hair', 'Wavy_Hair', 'Wearing_Earrings', 'Wearing_Hat', 'Wearing_Lipstick', 'Wearing_Necklace', 'Wearing_Necktie', 'Young'], typing.Dict[str, ethicml.data.util.LabelGroup]]) –
- Return type
None
- __len__()#
Number of elements in the dataset.
- Return type
int
- property class_labels: List[str]#
Get the list of class labels.
- property continuous_features: List[str]#
List of features that are continuous.
- property disc_feature_groups: Optional[Dict[str, List[str]]]#
Dictionary of feature groups.
- property discrete_features: List[str]#
List of features that are discrete.
- expand_labels(label, label_type)#
Expand a label in the form of an index into all the subfeatures.
- Parameters
label (pandas.DataFrame) –
label_type (Literal['s', 'y']) –
- Return type
pandas.DataFrame
- property feature_split: ethicml.data.dataset.FeatureSplit#
Return a feature split dictionary.
This should have separate entries for the features, the labels and the sensitive attributes.
- property features_to_remove: List[str]#
Features that have to be removed from x.
- property filepath: pathlib.Path#
Filepath from which to load the data.
- load(ordered=False, labels_as_features=False)#
Load dataset from its CSV file.
- Parameters
ordered (bool) – if True, return features such that discrete come first, then continuous
labels_as_features (bool) – if True, the s and y labels are included in the x features
- Returns
DataTuple with dataframes of features, labels and sensitive attributes
- Return type
- load_aif()#
Load the dataset as an AIF360 dataset.
Experimental. Requires the aif360 library.
Ignores the type check as the return type is not yet defined.
- property name: str#
Name of the dataset.
- property ordered_features: ethicml.data.dataset.FeatureSplit#
Return an order features dictionary.
This should have separate entries for the features, the labels and the sensitive attributes, but the x features are ordered so first are the discrete features, then the continuous.
- property sens_attrs: List[str]#
Get the list of sensitive attributes.
- celeba(download_dir, label='Smiling', sens_attr='Male', download=False, check_integrity=True)#
Get CelebA dataset.
- Parameters
download_dir (str) –
label (Literal['5_o_Clock_Shadow', 'Arched_Eyebrows', 'Attractive', 'Bags_Under_Eyes', 'Bald', 'Bangs', 'Big_Lips', 'Big_Nose', 'Black_Hair', 'Blond_Hair', 'Blurry', 'Brown_Hair', 'Bushy_Eyebrows', 'Chubby', 'Double_Chin', 'Eyeglasses', 'Goatee', 'Gray_Hair', 'Heavy_Makeup', 'High_Cheekbones', 'Male', 'Mouth_Slightly_Open', 'Mustache', 'Narrow_Eyes', 'No_Beard', 'Oval_Face', 'Pale_Skin', 'Pointy_Nose', 'Receding_Hairline', 'Rosy_Cheeks', 'Sideburns', 'Smiling', 'Straight_Hair', 'Wavy_Hair', 'Wearing_Earrings', 'Wearing_Hat', 'Wearing_Lipstick', 'Wearing_Necklace', 'Wearing_Necktie', 'Young']) –
sens_attr (Union[Literal['5_o_Clock_Shadow', 'Arched_Eyebrows', 'Attractive', 'Bags_Under_Eyes', 'Bald', 'Bangs', 'Big_Lips', 'Big_Nose', 'Black_Hair', 'Blond_Hair', 'Blurry', 'Brown_Hair', 'Bushy_Eyebrows', 'Chubby', 'Double_Chin', 'Eyeglasses', 'Goatee', 'Gray_Hair', 'Heavy_Makeup', 'High_Cheekbones', 'Male', 'Mouth_Slightly_Open', 'Mustache', 'Narrow_Eyes', 'No_Beard', 'Oval_Face', 'Pale_Skin', 'Pointy_Nose', 'Receding_Hairline', 'Rosy_Cheeks', 'Sideburns', 'Smiling', 'Straight_Hair', 'Wavy_Hair', 'Wearing_Earrings', 'Wearing_Hat', 'Wearing_Lipstick', 'Wearing_Necklace', 'Wearing_Necktie', 'Young'], typing.Dict[str, ethicml.data.util.LabelGroup]]) –
download (bool) –
check_integrity (bool) –
- Return type
Tuple[Optional[ethicml.data.vision_data.celeba.CelebA], pathlib.Path]
Generated faces#
Generated faces.
- genfaces(download_dir, label='emotion', sens_attr='gender', download=False, check_integrity=True)#
Generated Faces dataset.
- Parameters
download_dir (str) –
label (Literal['gender', 'age', 'ethnicity', 'eye_color', 'hair_color', 'hair_length', 'emotion']) –
sens_attr (Literal['gender', 'age', 'ethnicity', 'eye_color', 'hair_color', 'hair_length', 'emotion']) –
download (bool) –
check_integrity (bool) –
- Return type
Tuple[Optional[ethicml.data.dataset.Dataset], pathlib.Path]