ProgramComputer commited on
Commit
37d2abc
·
1 Parent(s): 7a8567a

Update test.py

Browse files
Files changed (1) hide show
  1. test.py +31 -31
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
- 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
 
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