CoolFace
Datasetpublic

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.

sourceHugging Faceupdated 2y agoView on Hugging Face
1likes455downloads
Dataset Card

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: int8
Identity (identity)
  • โ€”Description: The identity feature 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 box feature 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 landmarks feature 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:

python
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")