refactor: all data
Browse files- files/000269e00f--64c8d84d089f4e44f6481bb0/2.jpg → data/attacks.tar.gz +2 -2
- Result.csv → data/presentation-attack-detection-2d-dataset.csv +0 -0
- files/000269e00f--64c8d84d089f4e44f6481bb0/3.mp4 +0 -3
- files/000269e00f--64c8f4db4a10835184c95641/2.jpg +0 -3
- files/000269e00f--64c8f4db4a10835184c95641/3.mp4 +0 -3
- files/000269e00f--64c8f55c64b09d4014084391/2.jpg +0 -3
- files/000269e00f--64c8f55c64b09d4014084391/3.mp4 +0 -3
- files/000269e00f--64c9cbf134a9be2301431749/2.jpg +0 -3
- files/000269e00f--64c9cbf134a9be2301431749/3.mp4 +0 -3
- files/000269e00f--64ca0aa684be481f7568360f/2.jpg +0 -3
- files/000269e00f--64ca0aa684be481f7568360f/3.MOV +0 -3
- files/000269e00f--64ca72f2c38b125fffa93c6e/2.jpg +0 -3
- files/000269e00f--64ca72f2c38b125fffa93c6e/3.mp4 +0 -3
- files/000269e00f--64caa8acb4858c670df55582/2.jpg +0 -3
- files/000269e00f--64caa8acb4858c670df55582/3.mp4 +0 -3
- files/000269e00f--64cb61c13dc862273921414f/2.jpg +0 -3
- files/000269e00f--64cb61c13dc862273921414f/3.mp4 +0 -3
- files/000269e00f--64cbccc402343312e74eccfb/2.jpg +0 -3
- files/000269e00f--64cbccc402343312e74eccfb/3.mp4 +0 -3
- files/000269e00f--64cce2f9747ca45dad369280/2.jpg +0 -3
- files/000269e00f--64cce2f9747ca45dad369280/3.mp4 +0 -3
- files/000269e00f--64ce34be591a914f7a454dae/2.jpg +0 -3
- files/000269e00f--64ce34be591a914f7a454dae/3.mp4 +0 -3
- files/000269e00f--64cf6c2ca3e04150ef4c19c2/2.jpg +0 -3
- files/000269e00f--64cf6c2ca3e04150ef4c19c2/3.MOV +0 -3
- files/000269e00f--64d1d284038f0820fecdab8b/2.jpg +0 -3
- files/000269e00f--64d1d284038f0820fecdab8b/3.mp4 +0 -3
- files/000269e00f--64d25998571de06b0eecc774/2.jpg +0 -3
- files/000269e00f--64d25998571de06b0eecc774/3.mp4 +0 -3
- presentation-attack-detection-2d-dataset.py +83 -0
files/000269e00f--64c8d84d089f4e44f6481bb0/2.jpg → data/attacks.tar.gz
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d274a43cec22d1736d35e9cd86f8af8c3066f2e3337f927e8a3c8c068cd04fd0
|
3 |
+
size 458881420
|
Result.csv → data/presentation-attack-detection-2d-dataset.csv
RENAMED
File without changes
|
files/000269e00f--64c8d84d089f4e44f6481bb0/3.mp4
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:4bfb8d3712fec27b2306aaa882e3b9ccdd58b7a7b7f7f5e72da856ec593a9fc6
|
3 |
-
size 35693421
|
|
|
|
|
|
|
|
files/000269e00f--64c8f4db4a10835184c95641/2.jpg
DELETED
Git LFS Details
|
files/000269e00f--64c8f4db4a10835184c95641/3.mp4
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:0d2a3126e8d4500e192e15bc71fa65eee6df81b6059cd25b0fec65dc556615cf
|
3 |
-
size 29130162
|
|
|
|
|
|
|
|
files/000269e00f--64c8f55c64b09d4014084391/2.jpg
DELETED
Git LFS Details
|
files/000269e00f--64c8f55c64b09d4014084391/3.mp4
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:2d8ee739c7a79e23e677c48cf62606d02c5b8fce965013719cc033f4a5a479e7
|
3 |
-
size 29855473
|
|
|
|
|
|
|
|
files/000269e00f--64c9cbf134a9be2301431749/2.jpg
DELETED
Git LFS Details
|
files/000269e00f--64c9cbf134a9be2301431749/3.mp4
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:672cbc06127406d86a7f6fc64a675ade5bb8100b4f6f2adafec814f4b60509ca
|
3 |
-
size 20297697
|
|
|
|
|
|
|
|
files/000269e00f--64ca0aa684be481f7568360f/2.jpg
DELETED
Git LFS Details
|
files/000269e00f--64ca0aa684be481f7568360f/3.MOV
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:2dbddb26499ff55e29b0f1c248ca8112a08cf3c7188b3aff558726b55de45518
|
3 |
-
size 36517070
|
|
|
|
|
|
|
|
files/000269e00f--64ca72f2c38b125fffa93c6e/2.jpg
DELETED
Git LFS Details
|
files/000269e00f--64ca72f2c38b125fffa93c6e/3.mp4
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:7b9ea3ba009fa9381edb11df9f48cfda47d9181e8dc369bf13979265e3d2b69e
|
3 |
-
size 49482389
|
|
|
|
|
|
|
|
files/000269e00f--64caa8acb4858c670df55582/2.jpg
DELETED
Git LFS Details
|
files/000269e00f--64caa8acb4858c670df55582/3.mp4
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:7ea0e13b3ff87f822605ae44ef31e11cba3a711581338bcd6f01cae0e6504544
|
3 |
-
size 10317431
|
|
|
|
|
|
|
|
files/000269e00f--64cb61c13dc862273921414f/2.jpg
DELETED
Git LFS Details
|
files/000269e00f--64cb61c13dc862273921414f/3.mp4
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:8f09bfce1c11737bf6f25205c83903716e621225b2f56a18401633231b48db4c
|
3 |
-
size 28215017
|
|
|
|
|
|
|
|
files/000269e00f--64cbccc402343312e74eccfb/2.jpg
DELETED
Git LFS Details
|
files/000269e00f--64cbccc402343312e74eccfb/3.mp4
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:95c6781399cd2a5368cab5b851b3d5f94943423b4341ee4c874273055e2cc01a
|
3 |
-
size 32080430
|
|
|
|
|
|
|
|
files/000269e00f--64cce2f9747ca45dad369280/2.jpg
DELETED
Git LFS Details
|
files/000269e00f--64cce2f9747ca45dad369280/3.mp4
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:a502352bf97aa0652449e921d54d8ce3ce9278c405a1d476c74545e41687d445
|
3 |
-
size 45720267
|
|
|
|
|
|
|
|
files/000269e00f--64ce34be591a914f7a454dae/2.jpg
DELETED
Git LFS Details
|
files/000269e00f--64ce34be591a914f7a454dae/3.mp4
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:a947f590f5cc0a4f9dbc76c0f7802190c9875761cec4fc03bc356e42dd1ab723
|
3 |
-
size 23043427
|
|
|
|
|
|
|
|
files/000269e00f--64cf6c2ca3e04150ef4c19c2/2.jpg
DELETED
Git LFS Details
|
files/000269e00f--64cf6c2ca3e04150ef4c19c2/3.MOV
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:302a299bce7f0aeb47b31765884f58a507f9d12a6f1b5af6a5921840fc48d692
|
3 |
-
size 31207878
|
|
|
|
|
|
|
|
files/000269e00f--64d1d284038f0820fecdab8b/2.jpg
DELETED
Git LFS Details
|
files/000269e00f--64d1d284038f0820fecdab8b/3.mp4
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:d769a5e42367e028fecccdbbcd29cd511e25800173408e21d3d59ece4d7e25c9
|
3 |
-
size 39626974
|
|
|
|
|
|
|
|
files/000269e00f--64d25998571de06b0eecc774/2.jpg
DELETED
Git LFS Details
|
files/000269e00f--64d25998571de06b0eecc774/3.mp4
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:4746be404ba86ad49be7cc3af81245f7ef21b4a4d7d67d592426a7810bc95731
|
3 |
-
size 5866023
|
|
|
|
|
|
|
|
presentation-attack-detection-2d-dataset.py
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from itertools import pairwise
|
2 |
+
|
3 |
+
import datasets
|
4 |
+
import pandas as pd
|
5 |
+
|
6 |
+
_CITATION = """\
|
7 |
+
@InProceedings{huggingface:dataset,
|
8 |
+
title = {presentation-attack-detection-2d-dataset},
|
9 |
+
author = {TrainingDataPro},
|
10 |
+
year = {2023}
|
11 |
+
}
|
12 |
+
"""
|
13 |
+
|
14 |
+
_DESCRIPTION = """\
|
15 |
+
The dataset consists of photos of individuals and videos of him/her wearing printed 2D
|
16 |
+
mask with cut-out holes for eyes. Videos are filmed in different lightning conditions
|
17 |
+
and in different places (*indoors, outdoors*), a person moves his/her head left, right,
|
18 |
+
up and down. Each video in the dataset has an approximate duration of 15-17 seconds.
|
19 |
+
"""
|
20 |
+
_NAME = "presentation-attack-detection-2d-dataset"
|
21 |
+
|
22 |
+
_HOMEPAGE = f"https://huggingface.co/datasets/TrainingDataPro/{_NAME}"
|
23 |
+
|
24 |
+
_LICENSE = ""
|
25 |
+
|
26 |
+
_DATA = f"https://huggingface.co/datasets/TrainingDataPro/{_NAME}/resolve/main/data/"
|
27 |
+
|
28 |
+
|
29 |
+
class PresentationAttackDetection2dDataset(datasets.GeneratorBasedBuilder):
|
30 |
+
def _info(self):
|
31 |
+
return datasets.DatasetInfo(
|
32 |
+
description=_DESCRIPTION,
|
33 |
+
features=datasets.Features(
|
34 |
+
{
|
35 |
+
"photo": datasets.Image(),
|
36 |
+
"video": datasets.Value("string"),
|
37 |
+
"worker_id": datasets.Value("string"),
|
38 |
+
"set_id": datasets.Value("string"),
|
39 |
+
"age": datasets.Value("int8"),
|
40 |
+
"country": datasets.Value("string"),
|
41 |
+
"gender": datasets.Value("string"),
|
42 |
+
}
|
43 |
+
),
|
44 |
+
supervised_keys=None,
|
45 |
+
homepage=_HOMEPAGE,
|
46 |
+
citation=_CITATION,
|
47 |
+
)
|
48 |
+
|
49 |
+
def _split_generators(self, dl_manager):
|
50 |
+
attacks = dl_manager.download(f"{_DATA}attacks.tar.gz")
|
51 |
+
annotations = dl_manager.download(f"{_DATA}{_NAME}.csv")
|
52 |
+
attacks = dl_manager.iter_archive(attacks)
|
53 |
+
return [
|
54 |
+
datasets.SplitGenerator(
|
55 |
+
name=datasets.Split.TRAIN,
|
56 |
+
gen_kwargs={"attacks": attacks, "annotations": annotations},
|
57 |
+
),
|
58 |
+
]
|
59 |
+
|
60 |
+
def _generate_examples(self, attacks, annotations):
|
61 |
+
annotations_df = pd.read_csv(annotations, sep=",")
|
62 |
+
for idx, ((image_path, image), (video_path, video)) in enumerate(
|
63 |
+
pairwise(attacks)
|
64 |
+
):
|
65 |
+
yield idx, {
|
66 |
+
"photo": {"path": image_path, "bytes": image.read()},
|
67 |
+
"video": video_path,
|
68 |
+
"worker_id": annotations_df.loc[
|
69 |
+
annotations_df["worker_id"] == image_path.split("/")[-2]
|
70 |
+
]["worker_id"].values[0],
|
71 |
+
"set_id": annotations_df.loc[
|
72 |
+
annotations_df["worker_id"] == image_path.split("/")[-2]
|
73 |
+
]["set_id"].values[0],
|
74 |
+
"age": annotations_df.loc[
|
75 |
+
annotations_df["worker_id"] == image_path.split("/")[-2]
|
76 |
+
]["age"].values[0],
|
77 |
+
"country": annotations_df.loc[
|
78 |
+
annotations_df["worker_id"] == image_path.split("/")[-2]
|
79 |
+
]["country"].values[0],
|
80 |
+
"gender": annotations_df.loc[
|
81 |
+
annotations_df["worker_id"] == image_path.split("/")[-2]
|
82 |
+
]["gender"].values[0],
|
83 |
+
}
|