refactor: all data feat: upload script
Browse files- 2d-printed_masks_attacks.py +78 -0
- 2d_masks.csv +0 -10
- 2d_masks/2.mp4 +0 -3
- 2d_masks/4.mp4 +0 -3
- 2d_masks/5.mp4 +0 -3
- 2d_masks/6.mp4 +0 -3
- 2d_masks/7.mp4 +0 -3
- 2d_masks/8.mp4 +0 -3
- data/2d-printed_masks_attacks.csv +10 -0
- 2d_masks/0.mp4 → data/2d_masks.tar.gz +2 -2
- 2d_masks/1.mp4 → data/live_selfie.tar.gz +2 -2
- 2d_masks/3.mp4 → data/live_video.tar.gz +2 -2
- live_selfie/0.png +0 -3
- live_selfie/1.png +0 -3
- live_selfie/2.png +0 -3
- live_selfie/3.png +0 -3
- live_selfie/4.png +0 -3
- live_selfie/5.png +0 -3
- live_selfie/6.png +0 -3
- live_selfie/7.png +0 -3
- live_selfie/8.png +0 -3
- live_video/0.mp4 +0 -3
- live_video/1.mp4 +0 -3
- live_video/2.mp4 +0 -3
- live_video/3.mp4 +0 -3
- live_video/4.mp4 +0 -3
- live_video/5.mp4 +0 -3
- live_video/6.mp4 +0 -3
- live_video/7.mp4 +0 -3
- live_video/8.mp4 +0 -3
2d-printed_masks_attacks.py
ADDED
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import datasets
|
2 |
+
import pandas as pd
|
3 |
+
|
4 |
+
_CITATION = """\
|
5 |
+
@InProceedings{huggingface:dataset,
|
6 |
+
title = {2d-printed_masks_attacks},
|
7 |
+
author = {TrainingDataPro},
|
8 |
+
year = {2023}
|
9 |
+
}
|
10 |
+
"""
|
11 |
+
|
12 |
+
_DESCRIPTION = """\
|
13 |
+
The dataset consists of 40,000 videos and selfies with unique people. 15,000
|
14 |
+
attack replays from 4,000 unique devices. 10,000 attacks with A4 printouts and
|
15 |
+
10,000 attacks with cut-out printouts.
|
16 |
+
"""
|
17 |
+
_NAME = '2d-printed_masks_attacks'
|
18 |
+
|
19 |
+
_HOMEPAGE = f"https://huggingface.co/datasets/TrainingDataPro/{_NAME}"
|
20 |
+
|
21 |
+
_LICENSE = "cc-by-nc-nd-4.0"
|
22 |
+
|
23 |
+
_DATA = f"https://huggingface.co/datasets/TrainingDataPro/{_NAME}/resolve/main/data/"
|
24 |
+
|
25 |
+
|
26 |
+
class PrintedMasksAttacks(datasets.GeneratorBasedBuilder):
|
27 |
+
|
28 |
+
def _info(self):
|
29 |
+
return datasets.DatasetInfo(description=_DESCRIPTION,
|
30 |
+
features=datasets.Features({
|
31 |
+
'2d_mask': datasets.Value('string'),
|
32 |
+
'live_selfie': datasets.Image(),
|
33 |
+
'live_video': datasets.Value('string'),
|
34 |
+
'phone_model': datasets.Value('string')
|
35 |
+
}),
|
36 |
+
supervised_keys=None,
|
37 |
+
homepage=_HOMEPAGE,
|
38 |
+
citation=_CITATION,
|
39 |
+
license=_LICENSE)
|
40 |
+
|
41 |
+
def _split_generators(self, dl_manager):
|
42 |
+
masks = dl_manager.download(f"{_DATA}attack.tar.gz")
|
43 |
+
live_selfies = dl_manager.download(f"{_DATA}live_selfie.tar.gz")
|
44 |
+
live_videos = dl_manager.download(f"{_DATA}live_video.tar.gz")
|
45 |
+
annotations = dl_manager.download(f"{_DATA}{_NAME}.csv")
|
46 |
+
masks = dl_manager.iter_archive(masks)
|
47 |
+
live_selfies = dl_manager.iter_archive(live_selfies)
|
48 |
+
live_videos = dl_manager.iter_archive(live_videos)
|
49 |
+
return [
|
50 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN,
|
51 |
+
gen_kwargs={
|
52 |
+
'attacks': masks,
|
53 |
+
"live_selfies": live_selfies,
|
54 |
+
'live_videos': live_videos,
|
55 |
+
'annotations': annotations
|
56 |
+
}),
|
57 |
+
]
|
58 |
+
|
59 |
+
def _generate_examples(self, masks, live_selfies, live_videos,
|
60 |
+
annotations):
|
61 |
+
for idx, ((mask_path, mask), (live_selfie_path, live_selfie),
|
62 |
+
(live_video_path, live_video)) in enumerate(
|
63 |
+
zip(masks, live_selfies, live_videos)):
|
64 |
+
annotations_df = pd.read_csv(annotations)
|
65 |
+
yield idx, {
|
66 |
+
'2d_mask':
|
67 |
+
mask_path,
|
68 |
+
'live_selfie': {
|
69 |
+
'path': live_selfie_path,
|
70 |
+
'bytes': live_selfie.read()
|
71 |
+
},
|
72 |
+
'live_video':
|
73 |
+
live_video_path,
|
74 |
+
'phone_model':
|
75 |
+
annotations_df.loc[
|
76 |
+
annotations_df['live_selfie'] == live_selfie_path]
|
77 |
+
['phone_model'].values[0]
|
78 |
+
}
|
2d_masks.csv
DELETED
@@ -1,10 +0,0 @@
|
|
1 |
-
live_selfie;live_video;phone_model;2d_masks
|
2 |
-
live_selfie/0.mp4;live_video/0.mp4;Xiaomi redmi note 9 pro;2d_masks/0.mp4
|
3 |
-
live_selfie/1.mp4;live_video/1.mp4;Xiaomi note 10s;2d_masks/1.mp4
|
4 |
-
live_selfie/2.mp4;live_video/2 .mp4;HONOR 10I ;2d_masks/2.mp4
|
5 |
-
live_selfie/3.mp4;live_video/3.mp4;Moto G30;2d_masks/3.mp4
|
6 |
-
live_selfie/4.mp4;live_video/4.mp4;Samsung Galaxy a22;2d_masks/4.mp4
|
7 |
-
live_selfie/5.mp4;live_video/5.mp4;Redmi note 9;2d_masks/5.mp4
|
8 |
-
live_selfie/6.mp4;live_video/6.mp4;Infinix note 11;2d_masks/6.mp4
|
9 |
-
live_selfie/7.mp4;live_video/7.mp4;Oppo a5s;2d_masks/7.mp4
|
10 |
-
live_selfie/8.mp4;live_video/8.mp4;Poco x3;2d_masks/8.mp4
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2d_masks/2.mp4
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:7f44147397f26751e6a10ee8fb6be8dc5fdc136ab8c800437fe85debca650db6
|
3 |
-
size 20740572
|
|
|
|
|
|
|
|
2d_masks/4.mp4
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:9af6b22aa8cd4ea1fe84ff543cd5b988ea2a38ed49f6b41cf54af86c4d4ba4e2
|
3 |
-
size 20761996
|
|
|
|
|
|
|
|
2d_masks/5.mp4
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:5262aadf6b0d0aa15a9400cecdece1e96d1212add34036bb0dd9e06979c8a885
|
3 |
-
size 22494557
|
|
|
|
|
|
|
|
2d_masks/6.mp4
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:a99472f16fcfb9ff8353448b453a9ae4ff90fd831c01793c2a942c8334fc831b
|
3 |
-
size 25580154
|
|
|
|
|
|
|
|
2d_masks/7.mp4
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:1ccebf3a33f6b81199fcb95666c1eab1e954ebbfcd845b367d2102cebc1fdb1f
|
3 |
-
size 15930746
|
|
|
|
|
|
|
|
2d_masks/8.mp4
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:a342833f7c97b1433fd256535193ad2a59148f342ed973497041d8afd7fe7bee
|
3 |
-
size 19313024
|
|
|
|
|
|
|
|
data/2d-printed_masks_attacks.csv
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
live_selfie;live_video;phone_model;2d_masks
|
2 |
+
0.png;0.mp4;Xiaomi redmi note 9 pro;0.mp4
|
3 |
+
1.png;1.mp4;Xiaomi note 10s;1.mp4
|
4 |
+
2.png;2.mp4;HONOR 10I ;2.mp4
|
5 |
+
3.png;3.mp4;Moto G30;3.mp4
|
6 |
+
4.png;4.mp4;Samsung Galaxy a22;4.mp4
|
7 |
+
5.png;5.mp4;Redmi note 9;5.mp4
|
8 |
+
6.png;6.mp4;Infinix note 11;6.mp4
|
9 |
+
7.png;7.mp4;Oppo a5s;7.mp4
|
10 |
+
8.png;8.mp4;Poco x3;8.mp4
|
2d_masks/0.mp4 → data/2d_masks.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:f7d66fc392396fda84b7862d41a5da5f7f40da485d369c05808b4288d55bc5d6
|
3 |
+
size 177710147
|
2d_masks/1.mp4 → data/live_selfie.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:6b257561e60c1ee4b5fe2913721dce700822b27b3fe7926a6aba15cbb92c440e
|
3 |
+
size 101143529
|
2d_masks/3.mp4 → data/live_video.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:af31e871ab39bba056d55fe32fe19ff195add6f2d8fe7b478256350e4b16505f
|
3 |
+
size 50102408
|
live_selfie/0.png
DELETED
Git LFS Details
|
live_selfie/1.png
DELETED
Git LFS Details
|
live_selfie/2.png
DELETED
Git LFS Details
|
live_selfie/3.png
DELETED
Git LFS Details
|
live_selfie/4.png
DELETED
Git LFS Details
|
live_selfie/5.png
DELETED
Git LFS Details
|
live_selfie/6.png
DELETED
Git LFS Details
|
live_selfie/7.png
DELETED
Git LFS Details
|
live_selfie/8.png
DELETED
Git LFS Details
|
live_video/0.mp4
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:b89ad5fbd87e4f4393fcf3cbde103cb9528a059c1aca590760f687a9b8371a8b
|
3 |
-
size 8745423
|
|
|
|
|
|
|
|
live_video/1.mp4
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:b9867da1784659b9c82b49081dfc7a325321f9ec36e0d2d761d27921edbc30d8
|
3 |
-
size 7011451
|
|
|
|
|
|
|
|
live_video/2.mp4
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:eca9c3440afd1fd6bb6e371eb448add7866847819f664f43d819ceb1d461e04e
|
3 |
-
size 5244697
|
|
|
|
|
|
|
|
live_video/3.mp4
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:05eb2f9bd50b1f4210324493b1fd84b261d5f88ee24da255778d63cb09ccae5c
|
3 |
-
size 5240856
|
|
|
|
|
|
|
|
live_video/4.mp4
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:c554ab1bd9f93db4ea93c3c95d658f29c1f3d087611b782941ab99bcecd8dc57
|
3 |
-
size 5968226
|
|
|
|
|
|
|
|
live_video/5.mp4
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:a4b31c265638b7736c1e86ce1596451f406b98a53d280a2d789e8574d6053d6c
|
3 |
-
size 3474118
|
|
|
|
|
|
|
|
live_video/6.mp4
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:069e0191ddba4ba2761998fa56edda7d72ae2edf563cf830f879b850be3810c8
|
3 |
-
size 3886679
|
|
|
|
|
|
|
|
live_video/7.mp4
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:6d853eeafb952d52d57f6da1260e86335b9e65bf9f8208b26c673dc3bc64d830
|
3 |
-
size 1157864
|
|
|
|
|
|
|
|
live_video/8.mp4
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:a2418951479b5530e3a07b73bc11e1dd80d90c29fd4e05f2b795b07f1b2f092e
|
3 |
-
size 9444609
|
|
|
|
|
|
|
|