Commit
·
37d2abc
1
Parent(s):
7a8567a
Update test.py
Browse files
test.py
CHANGED
@@ -314,35 +314,35 @@ class VoxCeleb(datasets.GeneratorBasedBuilder):
|
|
314 |
# raise Exception(find_mount_point(path))
|
315 |
#subdirs = [x[0] for x in os.walk(path)]
|
316 |
#raise Exception(subdirs)
|
317 |
-
|
318 |
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
|
|
314 |
# raise Exception(find_mount_point(path))
|
315 |
#subdirs = [x[0] for x in os.walk(path)]
|
316 |
#raise Exception(subdirs)
|
317 |
+
# for file in path:
|
318 |
|
319 |
+
#raise Exception(os.is_symlink(path))
|
320 |
+
#raise Exception(os.listdir(path))
|
321 |
+
try:
|
322 |
+
t = tuple(file.split("::")[0].split("/")[2:])
|
323 |
+
_,dataset_format,speaker,video_id,clip_index= (None,) * (5 - len(t)) + t
|
324 |
+
except Exception:
|
325 |
+
raise Exception(file.split("::")[0].split("/")[2:])
|
326 |
+
speaker_info = meta.loc[speaker]
|
327 |
+
clip_index = int(Path(clip_index).stem)
|
328 |
+
info = {
|
329 |
+
"file": file,
|
330 |
+
"file_format": dataset_format,
|
331 |
+
"dataset_id": dataset_id,
|
332 |
+
"speaker_id": speaker,
|
333 |
+
"speaker_gender": speaker_info["Gender"],
|
334 |
+
"video_id": video_id,
|
335 |
+
"clip_index": clip_index,
|
336 |
+
}
|
337 |
+
if dataset_id == "vox1":
|
338 |
+
info["speaker_name"] = speaker_info["VGGFace1 ID"]
|
339 |
+
info["speaker_nationality"] = speaker_info["Nationality"]
|
340 |
+
if conf.startswith("audio"):
|
341 |
+
info["audio"] = info["file"]
|
342 |
+
if conf.startswith("video"):
|
343 |
+
with fs.open(info["file"], 'rb') as f:
|
344 |
+
#buffer = BytesIO()
|
345 |
+
#f.write(buffer)
|
346 |
+
info["video"] = BytesIO(f.read()).getvalue()
|
347 |
+
yield key, info
|
348 |
+
key += 1
|