Hugo Flores Garcia commited on
Commit
84d4ed6
1 Parent(s): 9fbfaa6

fix baseline cond

Browse files
Files changed (4) hide show
  1. clmr +1 -0
  2. scripts/exp/eval.py +5 -2
  3. scripts/utils/vamp_folder.py +1 -1
  4. src/clmr +1 -0
clmr ADDED
@@ -0,0 +1 @@
 
 
1
+ Subproject commit c727542e5223a23a6fc2cb0b6161a6b1c5d302b2
scripts/exp/eval.py CHANGED
@@ -41,17 +41,20 @@ def eval(
41
  print(f"conditions: {conditions}")
42
 
43
  baseline_dir = exp_dir / baseline_key
44
- baseline_files = list(baseline_dir.glob(f"*{audio_ext}"))
45
 
46
  metrics = []
47
  for condition in conditions:
48
  cond_dir = exp_dir / condition
49
- cond_files = list(cond_dir.glob(f"*{audio_ext}"))
50
 
51
  print(f"computing fad for {baseline_dir} and {cond_dir}")
52
  frechet_score = frechet.score(baseline_dir, cond_dir)
53
 
54
  # make sure we have the same number of files
 
 
 
55
  assert len(list(baseline_files)) == len(list(cond_files)), f"number of files in {baseline_dir} and {cond_dir} do not match. {len(list(baseline_files))} vs {len(list(cond_files))}"
56
 
57
  pbar = tqdm(zip(baseline_files, cond_files), total=len(baseline_files))
 
41
  print(f"conditions: {conditions}")
42
 
43
  baseline_dir = exp_dir / baseline_key
44
+ baseline_files = sorted(list(baseline_dir.glob(f"*{audio_ext}")), key=lambda x: int(x.stem))
45
 
46
  metrics = []
47
  for condition in conditions:
48
  cond_dir = exp_dir / condition
49
+ cond_files = sorted(list(cond_dir.glob(f"*{audio_ext}")), key=lambda x: int(x.stem))
50
 
51
  print(f"computing fad for {baseline_dir} and {cond_dir}")
52
  frechet_score = frechet.score(baseline_dir, cond_dir)
53
 
54
  # make sure we have the same number of files
55
+ num_files = min(len(baseline_files), len(cond_files))
56
+ baseline_files = baseline_files[:num_files]
57
+ cond_files = cond_files[:num_files]
58
  assert len(list(baseline_files)) == len(list(cond_files)), f"number of files in {baseline_dir} and {cond_dir} do not match. {len(list(baseline_files))} vs {len(list(cond_files))}"
59
 
60
  pbar = tqdm(zip(baseline_files, cond_files), total=len(baseline_files))
scripts/utils/vamp_folder.py CHANGED
@@ -20,7 +20,7 @@ def condition(cond):
20
 
21
  @condition
22
  def baseline(sig, interface):
23
- return sig
24
 
25
  @condition
26
  def reconstructed(sig, interface):
 
20
 
21
  @condition
22
  def baseline(sig, interface):
23
+ return interface.preprocess(sig)
24
 
25
  @condition
26
  def reconstructed(sig, interface):
src/clmr ADDED
@@ -0,0 +1 @@
 
 
1
+ Subproject commit 423414d086350d04fd46e48bc74af30a208eff90