wip
Browse files
ANAKIN.py
CHANGED
@@ -76,7 +76,11 @@ class Anakin(datasets.GeneratorBasedBuilder):
|
|
76 |
"trimmed": datasets.Value("string"),
|
77 |
"edited": datasets.Value("string"),
|
78 |
"masks": datasets.Sequence(datasets.Image()),
|
79 |
-
|
|
|
|
|
|
|
|
|
80 |
}
|
81 |
)
|
82 |
else: # This is an example to show how to have different features for "first_domain" and "second_domain"
|
@@ -127,7 +131,6 @@ class Anakin(datasets.GeneratorBasedBuilder):
|
|
127 |
for idx in ids
|
128 |
]
|
129 |
data_dir = dl_manager.download(data_urls)
|
130 |
-
# data_dir = dl_manager.iter_files(data_dir)
|
131 |
mask_dir = {
|
132 |
idx: dl_manager.iter_archive(
|
133 |
dl_manager.download(root_url + f"masks/{idx}.zip")
|
@@ -168,11 +171,16 @@ class Anakin(datasets.GeneratorBasedBuilder):
|
|
168 |
def _generate_examples(self, files, masks, df):
|
169 |
for key, sample in enumerate(files):
|
170 |
idx = sample["trimmed"].split("/")[-1].split(".")[0]
|
171 |
-
|
|
|
172 |
sample["masks"] = [
|
173 |
{"path": p, "bytes": im.read()} for p, im in masks[idx]
|
174 |
]
|
175 |
else:
|
176 |
sample["masks"] = None
|
177 |
-
|
|
|
|
|
|
|
|
|
178 |
yield key, sample
|
|
|
76 |
"trimmed": datasets.Value("string"),
|
77 |
"edited": datasets.Value("string"),
|
78 |
"masks": datasets.Sequence(datasets.Image()),
|
79 |
+
"task": datasets.Value("string"),
|
80 |
+
"start-time": datasets.Value("int32"),
|
81 |
+
"end-time": datasets.Value("int32"),
|
82 |
+
"manipulation-type": datasets.Value("string"),
|
83 |
+
"editor-id": datasets.Value("string"),
|
84 |
}
|
85 |
)
|
86 |
else: # This is an example to show how to have different features for "first_domain" and "second_domain"
|
|
|
131 |
for idx in ids
|
132 |
]
|
133 |
data_dir = dl_manager.download(data_urls)
|
|
|
134 |
mask_dir = {
|
135 |
idx: dl_manager.iter_archive(
|
136 |
dl_manager.download(root_url + f"masks/{idx}.zip")
|
|
|
171 |
def _generate_examples(self, files, masks, df):
|
172 |
for key, sample in enumerate(files):
|
173 |
idx = sample["trimmed"].split("/")[-1].split(".")[0]
|
174 |
+
entry = df[df["video-id"] == idx]
|
175 |
+
if entry["has-masks"].values[0]:
|
176 |
sample["masks"] = [
|
177 |
{"path": p, "bytes": im.read()} for p, im in masks[idx]
|
178 |
]
|
179 |
else:
|
180 |
sample["masks"] = None
|
181 |
+
sample["task"] = entry["task"].values[0]
|
182 |
+
sample["start-time"] = entry["start-time"].values[0]
|
183 |
+
sample["end-time"] = entry["end-time"].values[0]
|
184 |
+
sample["manipulation-type"] = entry["manipulation-type"].values[0]
|
185 |
+
sample["editor-id"] = entry["editor-id"].values[0]
|
186 |
yield key, sample
|