metadata
dataset_info:
features:
- name: image
dtype: image
- name: attributes
sequence: int8
length: 40
- name: identity
dtype: int64
- name: bbox
sequence: int32
length: 4
- name: landmarks
sequence: int32
length: 10
splits:
- name: train
num_bytes: 8645556172.75
num_examples: 162770
- name: validation
num_bytes: 142232383.301
num_examples: 19867
- name: test
num_bytes: 141332777.292
num_examples: 19962
download_size: 8917038019
dataset_size: 8929121333.343
configs:
- config_name: default
data_files:
- split: train
path: data/train-*
- split: validation
path: data/validation-*
- split: test
path: data/test-*
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:
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")