matybohacek
commited on
Commit
•
2c67d52
1
Parent(s):
b014083
Create deepaction_v1.py
Browse files- deepaction_v1.py +62 -0
deepaction_v1.py
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import datasets
|
3 |
+
|
4 |
+
_CITATION = """\
|
5 |
+
@inproceedings{tbd,
|
6 |
+
title={tbd},
|
7 |
+
author={tbd},
|
8 |
+
year={2024},
|
9 |
+
url={https://huggingface.co/datasets/faridlab/deepaction_v1}
|
10 |
+
}
|
11 |
+
"""
|
12 |
+
|
13 |
+
_DESCRIPTION = """\
|
14 |
+
TBD
|
15 |
+
"""
|
16 |
+
|
17 |
+
_HOMEPAGE = "https://huggingface.co/datasets/faridlab/deepaction_v1"
|
18 |
+
|
19 |
+
_LICENSE = "TBD"
|
20 |
+
|
21 |
+
class DeepActionV1(datasets.GeneratorBasedBuilder):
|
22 |
+
VERSION = datasets.Version("1.0.0")
|
23 |
+
|
24 |
+
def _info(self):
|
25 |
+
return datasets.DatasetInfo(
|
26 |
+
description=_DESCRIPTION,
|
27 |
+
features=datasets.Features({
|
28 |
+
"video": datasets.Video(),
|
29 |
+
"label": datasets.ClassLabel(names=["VideoPoet", "BDAnimateDiffLightning", "CogVideoX5B", "Pexels", "RunwayML", "StableDiffusion", "Veo"]), # Add all category names
|
30 |
+
}),
|
31 |
+
supervised_keys=("video", "label"),
|
32 |
+
homepage=_HOMEPAGE,
|
33 |
+
license=_LICENSE,
|
34 |
+
citation=_CITATION,
|
35 |
+
)
|
36 |
+
|
37 |
+
def _split_generators(self, dl_manager):
|
38 |
+
url = "https://huggingface.co/datasets/faridlab/deepaction_v1/resolve/main/data.zip"
|
39 |
+
data_dir = dl_manager.download_and_extract(url)
|
40 |
+
|
41 |
+
return [
|
42 |
+
datasets.SplitGenerator(
|
43 |
+
name=datasets.Split.TRAIN,
|
44 |
+
gen_kwargs={"data_dir": data_dir},
|
45 |
+
),
|
46 |
+
]
|
47 |
+
|
48 |
+
def _generate_examples(self, data_dir):
|
49 |
+
label_names = os.listdir(data_dir)
|
50 |
+
for label in label_names:
|
51 |
+
label_dir = os.path.join(data_dir, label)
|
52 |
+
if os.path.isdir(label_dir):
|
53 |
+
for subfolder in os.listdir(label_dir):
|
54 |
+
subfolder_path = os.path.join(label_dir, subfolder)
|
55 |
+
if os.path.isdir(subfolder_path):
|
56 |
+
for video_file in os.listdir(subfolder_path):
|
57 |
+
if video_file.endswith(".mp4"):
|
58 |
+
video_path = os.path.join(subfolder_path, video_file)
|
59 |
+
yield video_path, {
|
60 |
+
"video": video_path,
|
61 |
+
"label": label,
|
62 |
+
}
|