start preparing configs
Browse files
ANAKIN.py
CHANGED
@@ -35,8 +35,13 @@ _LICENSE = "cc-by-4.0"
|
|
35 |
|
36 |
# The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
|
37 |
# This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
|
38 |
-
|
39 |
-
|
|
|
|
|
|
|
|
|
|
|
40 |
}
|
41 |
|
42 |
|
@@ -83,11 +88,44 @@ class Anakin(datasets.GeneratorBasedBuilder):
|
|
83 |
"editor-id": datasets.Value("string"),
|
84 |
}
|
85 |
)
|
86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
features = datasets.Features(
|
88 |
{
|
89 |
-
"
|
90 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
}
|
92 |
)
|
93 |
return datasets.DatasetInfo(
|
@@ -113,8 +151,7 @@ class Anakin(datasets.GeneratorBasedBuilder):
|
|
113 |
# dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
|
114 |
# It can accept any type or nested list/dict and will give back the same structure with the url replaced with path to local files.
|
115 |
# By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
|
116 |
-
|
117 |
-
metadata_dir = dl_manager.download_and_extract(urls)
|
118 |
|
119 |
random.seed(47)
|
120 |
root_url = "https://huggingface.co/datasets/AlexBlck/ANAKIN/resolve/main/"
|
@@ -122,12 +159,9 @@ class Anakin(datasets.GeneratorBasedBuilder):
|
|
122 |
ids = df["video-id"].to_list()
|
123 |
random.shuffle(ids)
|
124 |
|
|
|
125 |
data_urls = [
|
126 |
-
{
|
127 |
-
"full": root_url + f"full/{idx}.mp4",
|
128 |
-
"trimmed": root_url + f"trimmed/{idx}.mp4",
|
129 |
-
"edited": root_url + f"edited/{idx}.mp4",
|
130 |
-
}
|
131 |
for idx in ids
|
132 |
]
|
133 |
data_dir = dl_manager.download(data_urls)
|
|
|
35 |
|
36 |
# The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
|
37 |
# This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
|
38 |
+
_METADATA_URL = "https://huggingface.co/datasets/AlexBlck/ANAKIN/raw/main/metadata.csv"
|
39 |
+
|
40 |
+
_FOLDERS = {
|
41 |
+
"all": ("full", "trimmed", "edited", "masks"),
|
42 |
+
"no-full": ("trimmed", "edited", "masks"),
|
43 |
+
"trimmed-edited-masks": ("trimmed", "edited", "masks"),
|
44 |
+
"full-trimmed-edited-masks": ("full", "trimmed", "edited", "masks"),
|
45 |
}
|
46 |
|
47 |
|
|
|
88 |
"editor-id": datasets.Value("string"),
|
89 |
}
|
90 |
)
|
91 |
+
elif self.config.name == "no-full":
|
92 |
+
features = datasets.Features(
|
93 |
+
{
|
94 |
+
"trimmed": datasets.Value("string"),
|
95 |
+
"edited": datasets.Value("string"),
|
96 |
+
"masks": datasets.Sequence(datasets.Image()),
|
97 |
+
"task": datasets.Value("string"),
|
98 |
+
"start-time": datasets.Value("int32"),
|
99 |
+
"end-time": datasets.Value("int32"),
|
100 |
+
"manipulation-type": datasets.Value("string"),
|
101 |
+
"editor-id": datasets.Value("string"),
|
102 |
+
}
|
103 |
+
)
|
104 |
+
elif self.config.name == "trimmed-edited-masks":
|
105 |
+
features = datasets.Features(
|
106 |
+
{
|
107 |
+
"trimmed": datasets.Value("string"),
|
108 |
+
"edited": datasets.Value("string"),
|
109 |
+
"masks": datasets.Sequence(datasets.Image()),
|
110 |
+
"task": datasets.Value("string"),
|
111 |
+
"start-time": datasets.Value("int32"),
|
112 |
+
"end-time": datasets.Value("int32"),
|
113 |
+
"manipulation-type": datasets.Value("string"),
|
114 |
+
"editor-id": datasets.Value("string"),
|
115 |
+
}
|
116 |
+
)
|
117 |
+
elif self.config.name == "full-trimmed-edited-masks":
|
118 |
features = datasets.Features(
|
119 |
{
|
120 |
+
"full": datasets.Value("string"),
|
121 |
+
"trimmed": datasets.Value("string"),
|
122 |
+
"edited": datasets.Value("string"),
|
123 |
+
"masks": datasets.Sequence(datasets.Image()),
|
124 |
+
"task": datasets.Value("string"),
|
125 |
+
"start-time": datasets.Value("int32"),
|
126 |
+
"end-time": datasets.Value("int32"),
|
127 |
+
"manipulation-type": datasets.Value("string"),
|
128 |
+
"editor-id": datasets.Value("string"),
|
129 |
}
|
130 |
)
|
131 |
return datasets.DatasetInfo(
|
|
|
151 |
# dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
|
152 |
# It can accept any type or nested list/dict and will give back the same structure with the url replaced with path to local files.
|
153 |
# By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
|
154 |
+
metadata_dir = dl_manager.download_and_extract(_METADATA_URL)
|
|
|
155 |
|
156 |
random.seed(47)
|
157 |
root_url = "https://huggingface.co/datasets/AlexBlck/ANAKIN/resolve/main/"
|
|
|
159 |
ids = df["video-id"].to_list()
|
160 |
random.shuffle(ids)
|
161 |
|
162 |
+
folders = _FOLDERS[self.config.name]
|
163 |
data_urls = [
|
164 |
+
{f"{folder}": root_url + f"{folder}/{idx}.mp4" for folder in folders}
|
|
|
|
|
|
|
|
|
165 |
for idx in ids
|
166 |
]
|
167 |
data_dir = dl_manager.download(data_urls)
|