Datasets:

Modalities:
Image
Formats:
parquet
Libraries:
Datasets
Dask
giulio98 commited on
Commit
e9092e9
1 Parent(s): 4011e11

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +60 -0
README.md CHANGED
@@ -36,3 +36,63 @@ configs:
36
  - split: test
37
  path: data/test-*
38
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  - split: test
37
  path: data/test-*
38
  ---
39
+ Porting of the famous [celeba dataset](https://mmlab.ie.cuhk.edu.hk/projects/CelebA.html) to 🤗 Datasets.
40
+ ### Dataset Component Descriptions
41
+
42
+ #### Attributes (`attr`)
43
+ - **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.
44
+ - **Data Type**: Sequence
45
+ - **Length**: `40`
46
+ - **Dtype**: `int8`
47
+
48
+ #### Identity (`identity`)
49
+ - **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.
50
+ - **Data Type**: `int64`
51
+ - **Unique Identifiers**: Each integer value corresponds to a unique individual.
52
+
53
+ #### Bounding Box (`bbox`)
54
+ - **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.
55
+ - **Data Type**: Sequence
56
+ - **Length**: `4`
57
+ - **Dtype**: `int32`
58
+ - **Details**: The format is `[x, y, width, height]`, where `(x, y)` are the coordinates of the top-left corner of the bounding box.
59
+
60
+ #### Landmarks (`landmarks`)
61
+ - **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.
62
+ - **Data Type**: Sequence
63
+ - **Length**: `10`
64
+ - **Dtype**: `int32`
65
+ - **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.
66
+
67
+ Script used for porting:
68
+ ```python
69
+ import torchvision
70
+ from datasets import Features, Dataset, Image as HFImage, ClassLabel, Sequence, Value
71
+ import numpy as np
72
+
73
+ celeba_dataset = torchvision.datasets.CelebA(root="./celeb_a", split="train",
74
+ target_type=["attr", "identity", "bbox", "landmarks"], download=False)
75
+ def gen():
76
+ for img, (attr, identity, bbox, landmarks) in celeba_dataset:
77
+ yield {
78
+ "image": img,
79
+ "attributes": attr.numpy(),
80
+ "identity": identity.item(),
81
+ "bbox": bbox.numpy(),
82
+ "landmarks": landmarks.numpy()
83
+ }
84
+
85
+ features = Features({
86
+ 'image': HFImage(decode=True, id=None),
87
+ 'attributes': Sequence(feature=Value("int8"), length=40),
88
+ 'identity': Value("int64"),
89
+ 'bbox': Sequence(feature=Value("int32"), length=4),
90
+ 'landmarks': Sequence(feature=Value("int32"), length=10)
91
+ })
92
+
93
+ # Create a Dataset object from the generator
94
+ hf_dataset = Dataset.from_generator(generator=gen, features=features)
95
+
96
+ # Push the dataset to the Hugging Face Hub
97
+ hf_dataset.push_to_hub("eurecom-ds/celeba", split="train")
98
+ ```