wip
Browse files
ANAKIN.py
CHANGED
@@ -178,6 +178,12 @@ class Anakin(datasets.GeneratorBasedBuilder):
|
|
178 |
|
179 |
train_end = int(len(df) * 0.7)
|
180 |
val_end = int(len(df) * 0.8)
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
data_dir = {}
|
182 |
mask_dir = {}
|
183 |
|
@@ -186,26 +192,20 @@ class Anakin(datasets.GeneratorBasedBuilder):
|
|
186 |
datasets.Split.VALIDATION,
|
187 |
datasets.Split.TEST,
|
188 |
]:
|
189 |
-
if split == datasets.Split.TRAIN:
|
190 |
-
split_ids = ids[:train_end]
|
191 |
-
elif split == datasets.Split.VALIDATION:
|
192 |
-
split_ids = ids[train_end:val_end]
|
193 |
-
else:
|
194 |
-
split_ids = ids[val_end:]
|
195 |
data_urls = [
|
196 |
{
|
197 |
f"{folder}": root_url + f"{folder}/{idx}.mp4"
|
198 |
for folder in folders
|
199 |
if folder != "masks"
|
200 |
}
|
201 |
-
for idx in split_ids
|
202 |
]
|
203 |
data_dir[split] = dl_manager.download(data_urls)
|
204 |
mask_dir[split] = {
|
205 |
idx: dl_manager.iter_archive(
|
206 |
dl_manager.download(root_url + f"masks/{idx}.zip")
|
207 |
)
|
208 |
-
for idx in split_ids
|
209 |
}
|
210 |
|
211 |
return [
|
@@ -215,6 +215,7 @@ class Anakin(datasets.GeneratorBasedBuilder):
|
|
215 |
"files": data_dir[split],
|
216 |
"masks": mask_dir[split],
|
217 |
"df": df,
|
|
|
218 |
"return_time": "full" in folders,
|
219 |
},
|
220 |
)
|
@@ -225,10 +226,8 @@ class Anakin(datasets.GeneratorBasedBuilder):
|
|
225 |
]
|
226 |
]
|
227 |
|
228 |
-
def _generate_examples(self, files, masks, df, return_time):
|
229 |
-
for key, sample in enumerate(files):
|
230 |
-
idx = sample["trimmed"].split("/")[-1].split(".")[0]
|
231 |
-
print(df)
|
232 |
print(idx)
|
233 |
entry = df[df["video-id"] == idx]
|
234 |
print(entry)
|
|
|
178 |
|
179 |
train_end = int(len(df) * 0.7)
|
180 |
val_end = int(len(df) * 0.8)
|
181 |
+
split_ids = {
|
182 |
+
datasets.Split.TRAIN: ids[:train_end],
|
183 |
+
datasets.Split.VALIDATION: ids[train_end:val_end],
|
184 |
+
datasets.Split.TEST: ids[val_end:],
|
185 |
+
}
|
186 |
+
|
187 |
data_dir = {}
|
188 |
mask_dir = {}
|
189 |
|
|
|
192 |
datasets.Split.VALIDATION,
|
193 |
datasets.Split.TEST,
|
194 |
]:
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
data_urls = [
|
196 |
{
|
197 |
f"{folder}": root_url + f"{folder}/{idx}.mp4"
|
198 |
for folder in folders
|
199 |
if folder != "masks"
|
200 |
}
|
201 |
+
for idx in split_ids[split]
|
202 |
]
|
203 |
data_dir[split] = dl_manager.download(data_urls)
|
204 |
mask_dir[split] = {
|
205 |
idx: dl_manager.iter_archive(
|
206 |
dl_manager.download(root_url + f"masks/{idx}.zip")
|
207 |
)
|
208 |
+
for idx in split_ids[split]
|
209 |
}
|
210 |
|
211 |
return [
|
|
|
215 |
"files": data_dir[split],
|
216 |
"masks": mask_dir[split],
|
217 |
"df": df,
|
218 |
+
"ids": split_ids[split],
|
219 |
"return_time": "full" in folders,
|
220 |
},
|
221 |
)
|
|
|
226 |
]
|
227 |
]
|
228 |
|
229 |
+
def _generate_examples(self, files, masks, df, ids, return_time):
|
230 |
+
for key, (idx, sample) in enumerate(zip(ids, files)):
|
|
|
|
|
231 |
print(idx)
|
232 |
entry = df[df["video-id"] == idx]
|
233 |
print(entry)
|