cleanup
Browse files
ANAKIN.py
CHANGED
@@ -3,8 +3,6 @@ import random
|
|
3 |
import datasets
|
4 |
import pandas as pd
|
5 |
|
6 |
-
# TODO: Add BibTeX citation
|
7 |
-
# Find for instance the citation on arxiv or on the dataset repo/website
|
8 |
_CITATION = """\
|
9 |
@misc{black2023vader,
|
10 |
title={VADER: Video Alignment Differencing and Retrieval},
|
@@ -16,20 +14,14 @@ _CITATION = """\
|
|
16 |
}
|
17 |
"""
|
18 |
|
19 |
-
# TODO: Add description of the dataset here
|
20 |
-
# You can copy an official description
|
21 |
_DESCRIPTION = """\
|
22 |
ANAKIN is a dataset of mANipulated videos and mAsK annotatIoNs.
|
23 |
"""
|
24 |
|
25 |
-
# TODO: Add a link to an official homepage for the dataset here
|
26 |
_HOMEPAGE = "https://github.com/AlexBlck/vader"
|
27 |
|
28 |
-
# TODO: Add the licence for the dataset here if you can find it
|
29 |
_LICENSE = "cc-by-4.0"
|
30 |
|
31 |
-
# The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
|
32 |
-
# This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
|
33 |
_METADATA_URL = "https://huggingface.co/datasets/AlexBlck/ANAKIN/raw/main/metadata.csv"
|
34 |
|
35 |
_FOLDERS = {
|
@@ -40,9 +32,8 @@ _FOLDERS = {
|
|
40 |
}
|
41 |
|
42 |
|
43 |
-
# TODO: Name of the dataset usually matches the script name with CamelCase instead of snake_case
|
44 |
class Anakin(datasets.GeneratorBasedBuilder):
|
45 |
-
"""
|
46 |
|
47 |
VERSION = datasets.Version("1.0.0")
|
48 |
|
@@ -69,10 +60,9 @@ class Anakin(datasets.GeneratorBasedBuilder):
|
|
69 |
),
|
70 |
]
|
71 |
|
72 |
-
DEFAULT_CONFIG_NAME = "all"
|
73 |
|
74 |
def _info(self):
|
75 |
-
# TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
|
76 |
if self.config.name == "all":
|
77 |
features = datasets.Features(
|
78 |
{
|
@@ -124,28 +114,14 @@ class Anakin(datasets.GeneratorBasedBuilder):
|
|
124 |
}
|
125 |
)
|
126 |
return datasets.DatasetInfo(
|
127 |
-
# This is the description that will appear on the datasets page.
|
128 |
description=_DESCRIPTION,
|
129 |
-
|
130 |
-
features=features, # Here we define them above because they are different between the two configurations
|
131 |
-
# If there's a common (input, target) tuple from the features, uncomment supervised_keys line below and
|
132 |
-
# specify them. They'll be used if as_supervised=True in builder.as_dataset.
|
133 |
-
# supervised_keys=("sentence", "label"),
|
134 |
-
# Homepage of the dataset for documentation
|
135 |
homepage=_HOMEPAGE,
|
136 |
-
# License for the dataset if available
|
137 |
license=_LICENSE,
|
138 |
-
# Citation for the dataset
|
139 |
citation=_CITATION,
|
140 |
)
|
141 |
|
142 |
def _split_generators(self, dl_manager):
|
143 |
-
# TODO: This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
|
144 |
-
# If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
|
145 |
-
|
146 |
-
# dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
|
147 |
-
# 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.
|
148 |
-
# By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
|
149 |
metadata_dir = dl_manager.download(_METADATA_URL)
|
150 |
folders = _FOLDERS[self.config.name]
|
151 |
|
@@ -213,9 +189,7 @@ class Anakin(datasets.GeneratorBasedBuilder):
|
|
213 |
|
214 |
def _generate_examples(self, files, masks, df, ids, return_time):
|
215 |
for key, (idx, sample) in enumerate(zip(ids, files)):
|
216 |
-
print(idx)
|
217 |
entry = df[df["video-id"] == idx]
|
218 |
-
print(entry)
|
219 |
if idx in masks.keys():
|
220 |
sample["masks"] = [
|
221 |
{"path": p, "bytes": im.read()} for p, im in masks[idx]
|
|
|
3 |
import datasets
|
4 |
import pandas as pd
|
5 |
|
|
|
|
|
6 |
_CITATION = """\
|
7 |
@misc{black2023vader,
|
8 |
title={VADER: Video Alignment Differencing and Retrieval},
|
|
|
14 |
}
|
15 |
"""
|
16 |
|
|
|
|
|
17 |
_DESCRIPTION = """\
|
18 |
ANAKIN is a dataset of mANipulated videos and mAsK annotatIoNs.
|
19 |
"""
|
20 |
|
|
|
21 |
_HOMEPAGE = "https://github.com/AlexBlck/vader"
|
22 |
|
|
|
23 |
_LICENSE = "cc-by-4.0"
|
24 |
|
|
|
|
|
25 |
_METADATA_URL = "https://huggingface.co/datasets/AlexBlck/ANAKIN/raw/main/metadata.csv"
|
26 |
|
27 |
_FOLDERS = {
|
|
|
32 |
}
|
33 |
|
34 |
|
|
|
35 |
class Anakin(datasets.GeneratorBasedBuilder):
|
36 |
+
"""ANAKIN is a dataset of mANipulated videos and mAsK annotatIoNs."""
|
37 |
|
38 |
VERSION = datasets.Version("1.0.0")
|
39 |
|
|
|
60 |
),
|
61 |
]
|
62 |
|
63 |
+
DEFAULT_CONFIG_NAME = "all"
|
64 |
|
65 |
def _info(self):
|
|
|
66 |
if self.config.name == "all":
|
67 |
features = datasets.Features(
|
68 |
{
|
|
|
114 |
}
|
115 |
)
|
116 |
return datasets.DatasetInfo(
|
|
|
117 |
description=_DESCRIPTION,
|
118 |
+
features=features,
|
|
|
|
|
|
|
|
|
|
|
119 |
homepage=_HOMEPAGE,
|
|
|
120 |
license=_LICENSE,
|
|
|
121 |
citation=_CITATION,
|
122 |
)
|
123 |
|
124 |
def _split_generators(self, dl_manager):
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
metadata_dir = dl_manager.download(_METADATA_URL)
|
126 |
folders = _FOLDERS[self.config.name]
|
127 |
|
|
|
189 |
|
190 |
def _generate_examples(self, files, masks, df, ids, return_time):
|
191 |
for key, (idx, sample) in enumerate(zip(ids, files)):
|
|
|
192 |
entry = df[df["video-id"] == idx]
|
|
|
193 |
if idx in masks.keys():
|
194 |
sample["masks"] = [
|
195 |
{"path": p, "bytes": im.read()} for p, im in masks[idx]
|