eurecom-ds/celeba
Porting of the famous celeba dataset to ๐ค Datasets. Dataset Component Descriptions Attributes (attr) Description: The attributes feature consists of binary labels that represent the presence or absence of 40 different facial attributes. Each attribute is encoded as either 0 (absence) or 1 (presence). These attributes cover a wide range of facial characteristics and styles, such as "Smiling", "Wearing Hat", "Eyeglasses", etc. Data Type: Sequence Length: 40 Dtype:โฆ See the full description on the dataset page: https://huggingface.co/datasets/eurecom-ds/celeba.
1455
Porting of the famous celeba dataset to ๐ค Datasets.
Dataset Component Descriptions
Attributes (attr)
- Description: The
attributesfeature consists of binary labels that represent the presence or absence of 40 different facial attributes. Each attribute is encoded as either 0 (absence) or 1 (presence). These attributes cover a wide range of facial characteristics and styles, such as "Smiling", "Wearing Hat", "Eyeglasses", etc. - Data Type: Sequence
- Length:
40 - Dtype:
int8
Identity (identity)
- Description: The
identityfeature represents the label for each individual in the dataset. It is used to identify which images belong to the same person. This allows for tasks such as face recognition and verification, where the goal is to match different images of the same person. - Data Type:
int64 - Unique Identifiers: Each integer value corresponds to a unique individual.
Bounding Box (bbox)
- Description: The
bounding boxfeature provides the coordinates for a rectangle that encapsulates the face in each image. This is useful for tasks where the face needs to be isolated or focused upon. The bounding box is defined by four integers: the x and y coordinates of the top-left corner, followed by the width and height of the box. - Data Type: Sequence
- Length:
4 - Dtype:
int32 - Details: The format is
[x, y, width, height], where(x, y)are the coordinates of the top-left corner of the bounding box.
Landmarks (landmarks)
- Description: The
landmarksfeature specifies the coordinates of key facial points, which are crucial for detailed facial analysis and tasks like advanced face manipulation or animation. These landmarks identify the positions of critical facial components such as the eyes, nose, and mouth. - Data Type: Sequence
- Length:
10 - Dtype:
int32 - Details: The format is
[lefteye_x, lefteye_y, righteye_x, righteye_y, nose_x, nose_y, leftmouth_x, leftmouth_y, rightmouth_x, rightmouth_y], representing the x and y coordinates of each landmark point.
Script used for porting:
import torchvision
from datasets import Features, Dataset, Image as HFImage, ClassLabel, Sequence, Value
import numpy as np
celeba_dataset = torchvision.datasets.CelebA(root="./celeb_a", split="train",
target_type=["attr", "identity", "bbox", "landmarks"], download=False)
def gen():
for img, (attr, identity, bbox, landmarks) in celeba_dataset:
yield {
"image": img,
"attributes": attr.numpy(),
"identity": identity.item(),
"bbox": bbox.numpy(),
"landmarks": landmarks.numpy()
}
features = Features({
'image': HFImage(decode=True, id=None),
'attributes': Sequence(feature=Value("int8"), length=40),
'identity': Value("int64"),
'bbox': Sequence(feature=Value("int32"), length=4),
'landmarks': Sequence(feature=Value("int32"), length=10)
})
# Create a Dataset object from the generator
hf_dataset = Dataset.from_generator(generator=gen, features=features)
# Push the dataset to the Hugging Face Hub
hf_dataset.push_to_hub("eurecom-ds/celeba", split="train")