Datasets:
refactor: all data
Browse files- Masks_10.csv β data/face_masks.csv +0 -0
- data/images.tar.gz +3 -0
- {img β data/images}/000131f21f--5ff282eb6341936754261bc0/1.jpg +0 -0
- {img β data/images}/000131f21f--5ff282eb6341936754261bc0/2.jpg +0 -0
- {img β data/images}/000131f21f--5ff282eb6341936754261bc0/3.jpg +0 -0
- {img β data/images}/000131f21f--5ff282eb6341936754261bc0/4.jpg +0 -0
- {img β data/images}/000131f21f--5ff2c49777fa9876e2fc0d00/1.jpg +0 -0
- {img β data/images}/000131f21f--5ff2c49777fa9876e2fc0d00/2.jpg +0 -0
- {img β data/images}/000131f21f--5ff2c49777fa9876e2fc0d00/3.jpg +0 -0
- {img β data/images}/000131f21f--5ff2c49777fa9876e2fc0d00/4.jpg +0 -0
- {img β data/images}/000131f21f--5ff6e209684918510576666a/1.jpg +0 -0
- {img β data/images}/000131f21f--5ff6e209684918510576666a/2.jpg +0 -0
- {img β data/images}/000131f21f--5ff6e209684918510576666a/3.jpg +0 -0
- {img β data/images}/000131f21f--5ff6e209684918510576666a/4.jpg +0 -0
- {img β data/images}/000131f21f--5ff773a4bc89186d24f05952/1.jpg +0 -0
- {img β data/images}/000131f21f--5ff773a4bc89186d24f05952/2.jpg +0 -0
- {img β data/images}/000131f21f--5ff773a4bc89186d24f05952/3.jpg +0 -0
- {img β data/images}/000131f21f--5ff773a4bc89186d24f05952/4.jpg +0 -0
- {img β data/images}/000131f21f--5ffc71161327c8449f9607c6/1.jpg +0 -0
- {img β data/images}/000131f21f--5ffc71161327c8449f9607c6/2.jpg +0 -0
- {img β data/images}/000131f21f--5ffc71161327c8449f9607c6/3.jpg +0 -0
- {img β data/images}/000131f21f--5ffc71161327c8449f9607c6/4.jpg +0 -0
- {img β data/images}/000131f21f--5ffd209285a5453c82d1d7c9/1.jpg +0 -0
- {img β data/images}/000131f21f--5ffd209285a5453c82d1d7c9/2.jpg +0 -0
- {img β data/images}/000131f21f--5ffd209285a5453c82d1d7c9/3.jpg +0 -0
- {img β data/images}/000131f21f--5ffd209285a5453c82d1d7c9/4.jpg +0 -0
- {img β data/images}/000131f21f--600c6e2940d36900d6e55d43/1.jpg +0 -0
- {img β data/images}/000131f21f--600c6e2940d36900d6e55d43/2.jpg +0 -0
- {img β data/images}/000131f21f--600c6e2940d36900d6e55d43/3.jpg +0 -0
- {img β data/images}/000131f21f--600c6e2940d36900d6e55d43/4.jpg +0 -0
- {img β data/images}/000131f21f--600ef55ead0db951a0b40685/1.jpg +0 -0
- {img β data/images}/000131f21f--600ef55ead0db951a0b40685/2.jpg +0 -0
- {img β data/images}/000131f21f--600ef55ead0db951a0b40685/3.jpg +0 -0
- {img β data/images}/000131f21f--600ef55ead0db951a0b40685/4.jpg +0 -0
- {img β data/images}/000131f21f--6014f71fb0c80760d6711041/1.jpg +0 -0
- {img β data/images}/000131f21f--6014f71fb0c80760d6711041/2.jpg +0 -0
- {img β data/images}/000131f21f--6014f71fb0c80760d6711041/3.jpg +0 -0
- {img β data/images}/000131f21f--6014f71fb0c80760d6711041/4.jpg +0 -0
- {img β data/images}/000131f21f--601da231b63c2f51d52483a7/1.jpg +0 -0
- {img β data/images}/000131f21f--601da231b63c2f51d52483a7/2.jpg +0 -0
- {img β data/images}/000131f21f--601da231b63c2f51d52483a7/3.jpg +0 -0
- {img β data/images}/000131f21f--601da231b63c2f51d52483a7/4.jpg +0 -0
- face_masks.py +117 -0
Masks_10.csv β data/face_masks.csv
RENAMED
|
File without changes
|
data/images.tar.gz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4ff240d4358c76c6bce20867ef54dfef1c5fe57bef7d42b3215f8f46124b29a1
|
| 3 |
+
size 100914635
|
{img β data/images}/000131f21f--5ff282eb6341936754261bc0/1.jpg
RENAMED
|
File without changes
|
{img β data/images}/000131f21f--5ff282eb6341936754261bc0/2.jpg
RENAMED
|
File without changes
|
{img β data/images}/000131f21f--5ff282eb6341936754261bc0/3.jpg
RENAMED
|
File without changes
|
{img β data/images}/000131f21f--5ff282eb6341936754261bc0/4.jpg
RENAMED
|
File without changes
|
{img β data/images}/000131f21f--5ff2c49777fa9876e2fc0d00/1.jpg
RENAMED
|
File without changes
|
{img β data/images}/000131f21f--5ff2c49777fa9876e2fc0d00/2.jpg
RENAMED
|
File without changes
|
{img β data/images}/000131f21f--5ff2c49777fa9876e2fc0d00/3.jpg
RENAMED
|
File without changes
|
{img β data/images}/000131f21f--5ff2c49777fa9876e2fc0d00/4.jpg
RENAMED
|
File without changes
|
{img β data/images}/000131f21f--5ff6e209684918510576666a/1.jpg
RENAMED
|
File without changes
|
{img β data/images}/000131f21f--5ff6e209684918510576666a/2.jpg
RENAMED
|
File without changes
|
{img β data/images}/000131f21f--5ff6e209684918510576666a/3.jpg
RENAMED
|
File without changes
|
{img β data/images}/000131f21f--5ff6e209684918510576666a/4.jpg
RENAMED
|
File without changes
|
{img β data/images}/000131f21f--5ff773a4bc89186d24f05952/1.jpg
RENAMED
|
File without changes
|
{img β data/images}/000131f21f--5ff773a4bc89186d24f05952/2.jpg
RENAMED
|
File without changes
|
{img β data/images}/000131f21f--5ff773a4bc89186d24f05952/3.jpg
RENAMED
|
File without changes
|
{img β data/images}/000131f21f--5ff773a4bc89186d24f05952/4.jpg
RENAMED
|
File without changes
|
{img β data/images}/000131f21f--5ffc71161327c8449f9607c6/1.jpg
RENAMED
|
File without changes
|
{img β data/images}/000131f21f--5ffc71161327c8449f9607c6/2.jpg
RENAMED
|
File without changes
|
{img β data/images}/000131f21f--5ffc71161327c8449f9607c6/3.jpg
RENAMED
|
File without changes
|
{img β data/images}/000131f21f--5ffc71161327c8449f9607c6/4.jpg
RENAMED
|
File without changes
|
{img β data/images}/000131f21f--5ffd209285a5453c82d1d7c9/1.jpg
RENAMED
|
File without changes
|
{img β data/images}/000131f21f--5ffd209285a5453c82d1d7c9/2.jpg
RENAMED
|
File without changes
|
{img β data/images}/000131f21f--5ffd209285a5453c82d1d7c9/3.jpg
RENAMED
|
File without changes
|
{img β data/images}/000131f21f--5ffd209285a5453c82d1d7c9/4.jpg
RENAMED
|
File without changes
|
{img β data/images}/000131f21f--600c6e2940d36900d6e55d43/1.jpg
RENAMED
|
File without changes
|
{img β data/images}/000131f21f--600c6e2940d36900d6e55d43/2.jpg
RENAMED
|
File without changes
|
{img β data/images}/000131f21f--600c6e2940d36900d6e55d43/3.jpg
RENAMED
|
File without changes
|
{img β data/images}/000131f21f--600c6e2940d36900d6e55d43/4.jpg
RENAMED
|
File without changes
|
{img β data/images}/000131f21f--600ef55ead0db951a0b40685/1.jpg
RENAMED
|
File without changes
|
{img β data/images}/000131f21f--600ef55ead0db951a0b40685/2.jpg
RENAMED
|
File without changes
|
{img β data/images}/000131f21f--600ef55ead0db951a0b40685/3.jpg
RENAMED
|
File without changes
|
{img β data/images}/000131f21f--600ef55ead0db951a0b40685/4.jpg
RENAMED
|
File without changes
|
{img β data/images}/000131f21f--6014f71fb0c80760d6711041/1.jpg
RENAMED
|
File without changes
|
{img β data/images}/000131f21f--6014f71fb0c80760d6711041/2.jpg
RENAMED
|
File without changes
|
{img β data/images}/000131f21f--6014f71fb0c80760d6711041/3.jpg
RENAMED
|
File without changes
|
{img β data/images}/000131f21f--6014f71fb0c80760d6711041/4.jpg
RENAMED
|
File without changes
|
{img β data/images}/000131f21f--601da231b63c2f51d52483a7/1.jpg
RENAMED
|
File without changes
|
{img β data/images}/000131f21f--601da231b63c2f51d52483a7/2.jpg
RENAMED
|
File without changes
|
{img β data/images}/000131f21f--601da231b63c2f51d52483a7/3.jpg
RENAMED
|
File without changes
|
{img β data/images}/000131f21f--601da231b63c2f51d52483a7/4.jpg
RENAMED
|
File without changes
|
face_masks.py
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import datasets
|
| 2 |
+
import pandas as pd
|
| 3 |
+
|
| 4 |
+
_CITATION = """\
|
| 5 |
+
@InProceedings{huggingface:dataset,
|
| 6 |
+
title = {selfies_and_id},
|
| 7 |
+
author = {TrainingDataPro},
|
| 8 |
+
year = {2023}
|
| 9 |
+
}
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
_DESCRIPTION = """\
|
| 13 |
+
4083 sets, which includes 2 photos of a person from his documents and
|
| 14 |
+
13 selfies. 571 sets of Hispanics and 3512 sets of Caucasians.
|
| 15 |
+
Photo documents contains only a photo of a person.
|
| 16 |
+
All personal information from the document is hidden.
|
| 17 |
+
"""
|
| 18 |
+
_NAME = 'selfies_and_id'
|
| 19 |
+
|
| 20 |
+
_HOMEPAGE = f"https://huggingface.co/datasets/TrainingDataPro/{_NAME}"
|
| 21 |
+
|
| 22 |
+
_LICENSE = "cc-by-nc-nd-4.0"
|
| 23 |
+
|
| 24 |
+
_DATA = f"https://huggingface.co/datasets/TrainingDataPro/{_NAME}/resolve/main/data/"
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
class SelfiesAndId(datasets.GeneratorBasedBuilder):
|
| 28 |
+
"""Small sample of image-text pairs"""
|
| 29 |
+
|
| 30 |
+
def _info(self):
|
| 31 |
+
return datasets.DatasetInfo(
|
| 32 |
+
description=_DESCRIPTION,
|
| 33 |
+
features=datasets.Features({
|
| 34 |
+
'id_1': datasets.Image(),
|
| 35 |
+
'id_2': datasets.Image(),
|
| 36 |
+
'selfie_1': datasets.Image(),
|
| 37 |
+
'selfie_2': datasets.Image(),
|
| 38 |
+
'selfie_3': datasets.Image(),
|
| 39 |
+
'selfie_4': datasets.Image(),
|
| 40 |
+
'selfie_5': datasets.Image(),
|
| 41 |
+
'selfie_6': datasets.Image(),
|
| 42 |
+
'selfie_7': datasets.Image(),
|
| 43 |
+
'selfie_8': datasets.Image(),
|
| 44 |
+
'selfie_9': datasets.Image(),
|
| 45 |
+
'selfie_10': datasets.Image(),
|
| 46 |
+
'selfie_11': datasets.Image(),
|
| 47 |
+
'selfie_12': datasets.Image(),
|
| 48 |
+
'selfie_13': datasets.Image(),
|
| 49 |
+
'user_id': datasets.Value('string'),
|
| 50 |
+
'set_id': datasets.Value('string'),
|
| 51 |
+
'user_race': datasets.Value('string'),
|
| 52 |
+
'name': datasets.Value('string'),
|
| 53 |
+
'age': datasets.Value('int8'),
|
| 54 |
+
'country': datasets.Value('string'),
|
| 55 |
+
'gender': datasets.Value('string')
|
| 56 |
+
}),
|
| 57 |
+
supervised_keys=None,
|
| 58 |
+
homepage=_HOMEPAGE,
|
| 59 |
+
citation=_CITATION,
|
| 60 |
+
license=_LICENSE
|
| 61 |
+
)
|
| 62 |
+
|
| 63 |
+
def _split_generators(self, dl_manager):
|
| 64 |
+
images = dl_manager.download(f"{_DATA}images.tar.gz")
|
| 65 |
+
annotations = dl_manager.download(f"{_DATA}{_NAME}.csv")
|
| 66 |
+
images = dl_manager.iter_archive(images)
|
| 67 |
+
return [
|
| 68 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN,
|
| 69 |
+
gen_kwargs={
|
| 70 |
+
"images": images,
|
| 71 |
+
'annotations': annotations
|
| 72 |
+
}),
|
| 73 |
+
]
|
| 74 |
+
|
| 75 |
+
def _generate_examples(self, images, annotations):
|
| 76 |
+
annotations_df = pd.read_csv(annotations, sep=';')
|
| 77 |
+
images_data = pd.DataFrame(columns=['URL', 'Bytes'])
|
| 78 |
+
for idx, (image_path, image) in enumerate(images):
|
| 79 |
+
images_data.loc[idx] = {'URL': image_path, 'Bytes': image.read()}
|
| 80 |
+
|
| 81 |
+
annotations_df = pd.merge(annotations_df,
|
| 82 |
+
images_data,
|
| 83 |
+
how='left',
|
| 84 |
+
on=['URL'])
|
| 85 |
+
for idx, worker_id in enumerate(pd.unique(annotations_df['UserId'])):
|
| 86 |
+
annotation = annotations_df.loc[annotations_df['UserId'] ==
|
| 87 |
+
worker_id]
|
| 88 |
+
annotation = annotation.sort_values(['FName'])
|
| 89 |
+
data = {
|
| 90 |
+
row[5].lower(): {
|
| 91 |
+
'path': row[6],
|
| 92 |
+
'bytes': row[10]
|
| 93 |
+
} for row in annotation.itertuples()
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
age = annotation.loc[annotation['FName'] ==
|
| 97 |
+
'ID_1']['Age'].values[0]
|
| 98 |
+
country = annotation.loc[annotation['FName'] ==
|
| 99 |
+
'ID_1']['Country'].values[0]
|
| 100 |
+
gender = annotation.loc[annotation['FName'] ==
|
| 101 |
+
'ID_1']['Gender'].values[0]
|
| 102 |
+
set_id = annotation.loc[annotation['FName'] ==
|
| 103 |
+
'ID_1']['SetId'].values[0]
|
| 104 |
+
user_race = annotation.loc[annotation['FName'] ==
|
| 105 |
+
'ID_1']['UserRace'].values[0]
|
| 106 |
+
name = annotation.loc[annotation['FName'] ==
|
| 107 |
+
'ID_1']['Name'].values[0]
|
| 108 |
+
|
| 109 |
+
data['user_id'] = worker_id
|
| 110 |
+
data['age'] = age
|
| 111 |
+
data['country'] = country
|
| 112 |
+
data['gender'] = gender
|
| 113 |
+
data['set_id'] = set_id
|
| 114 |
+
data['user_race'] = user_race
|
| 115 |
+
data['name'] = name
|
| 116 |
+
|
| 117 |
+
yield idx, data
|