ProgramComputer commited on
Commit
a6d70c1
·
1 Parent(s): d36c78e

Remove loops

Browse files
Files changed (1) hide show
  1. test.py +19 -29
test.py CHANGED
@@ -299,9 +299,6 @@ class VoxCeleb(datasets.GeneratorBasedBuilder):
299
  )
300
 
301
  for path in paths[conf]:
302
- for w in path:
303
- raise Exception(w)
304
- #raise Exception([x for x in dl_manager.iter_files(path)])
305
  #raise Exception([x for x in Path(path).glob('**/*')])
306
  # def find_mount_point(path):
307
  # path = os.path.realpath(path)
@@ -309,34 +306,27 @@ class VoxCeleb(datasets.GeneratorBasedBuilder):
309
  # path = os.path.dirname(path)
310
  # return path
311
  # raise Exception(find_mount_point(path))
312
- subdirs = [x[0] for x in os.walk(path)]
313
  #raise Exception(subdirs)
314
 
315
 
316
  #raise Exception(os.is_symlink(path))
317
  #raise Exception(os.listdir(path))
318
- dataset_path = next(Path(path).iterdir())
319
- #dataset_format = dataset_path.name
320
- for speaker_path in dataset_path.iterdir():
321
- speaker = speaker_path.name
322
- speaker_info = meta.loc[speaker]
323
- for video in speaker_path.iterdir():
324
- video_id = video.name
325
- for clip in video.iterdir():
326
- clip_index = int(clip.stem)
327
- info = {
328
- "file": str(clip),
329
- "file_format": dataset_format,
330
- "dataset_id": dataset_id,
331
- "speaker_id": speaker,
332
- "speaker_gender": speaker_info["Gender"],
333
- "video_id": video_id,
334
- "clip_index": clip_index,
335
- }
336
- if dataset_id == "vox1":
337
- info["speaker_name"] = speaker_info["VGGFace1 ID"]
338
- info["speaker_nationality"] = speaker_info["Nationality"]
339
- if conf.startswith("audio"):
340
- info["audio"] = info["file"]
341
- yield key, info
342
- key += 1
 
299
  )
300
 
301
  for path in paths[conf]:
 
 
 
302
  #raise Exception([x for x in Path(path).glob('**/*')])
303
  # def find_mount_point(path):
304
  # path = os.path.realpath(path)
 
306
  # path = os.path.dirname(path)
307
  # return path
308
  # raise Exception(find_mount_point(path))
309
+ #subdirs = [x[0] for x in os.walk(path)]
310
  #raise Exception(subdirs)
311
 
312
 
313
  #raise Exception(os.is_symlink(path))
314
  #raise Exception(os.listdir(path))
315
+ dataset_format,speaker_path,video_id,clip_index= url.split("::")[0].split("/")[2:]
316
+ clip_index = int(Path(clip_index).stem)
317
+ info = {
318
+ "file": str(clip),
319
+ "file_format": dataset_format,
320
+ "dataset_id": dataset_id,
321
+ "speaker_id": speaker,
322
+ "speaker_gender": speaker_info["Gender"],
323
+ "video_id": video_id,
324
+ "clip_index": clip_index,
325
+ }
326
+ if dataset_id == "vox1":
327
+ info["speaker_name"] = speaker_info["VGGFace1 ID"]
328
+ info["speaker_nationality"] = speaker_info["Nationality"]
329
+ if conf.startswith("audio"):
330
+ info["audio"] = info["file"]
331
+ yield key, info
332
+ key += 1