adobe-research / MetaAF

Control adaptive filters with neural networks.
https://jmcasebeer.github.io/projects/metaaf
218 stars 38 forks source link

rir_idx index out of range #9

Closed DeboBurro closed 1 year ago

DeboBurro commented 1 year ago

git tag : v1.0.0 model : 1.0.0 checkpoint dataset: AEC-challenge and RIRS US mirror content of the zoo/__config__.py file:

AEC_DATA_DIR = "/home/username/personal/dataset/AEC-Challenge/"
RIR_DATA_DIR = "/home/username/personal/rirs_noises/RIRS_NOISES/"
.
.

Cannot run aec_eval.py using pretrained model on the datasets

(metaenv) username@hostname:~/personal/MetaAF1.0.0/MetaAF-1.0.0/zoo/aec$ python aec_eval.py --name meta_aec_16_combo_rl_4_1024_512  --date 2022_08_29_01_10_31  --epoch 110 --ckpt_dir ~/personal/MetaAF1.0.0/MetaAF-1.0.0/1.0.0-model/v1.0.0_models/aec
{'ckpt_dir': '/home/username/personal/MetaAF1.0.0/MetaAF-1.0.0/1.0.0-model/v1.0.0_models/aec',
 'date': '2022_08_29_01_10_31',
 'epoch': 110,
 'name': 'meta_aec_16_combo_rl_4_1024_512',
 'out_dir': './meta_outputs',
 'save_metrics': False,
 'save_outputs': False,
 'system_len': None,
 'true_rir_len': None,
 'universal': False}
WARNING:jax._src.lib.xla_bridge:No GPU/TPU found, falling back to CPU. (Set TF_CPP_MIN_LOG_LEVEL=0 and rerun for more info.)
 --- Testing Dataset ---
 --- DT_False_SC_False_NL_False_TR_DEFAULT_SL_DEFAULT ---
  0%|                                                                       | 0/500 [00:00<?, ?it/s]0, 0
  0%|                                                                       | 0/500 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "aec_eval.py", line 305, in <module>
    system, fit_infer, test_dataset, out_dir, test_dataset_names[i], eval_kwargs
  File "aec_eval.py", line 151, in run_eval
    data = test_dataset[i]
  File "/home/username/personal/MetaAF/zoo/aec/aec.py", line 285, in __getitem__
    data_dict = self.load_from_idx(idx)
  File "/home/username/personal/MetaAF/zoo/aec/aec.py", line 233, in load_from_idx
    w, _ = sf.read(self.rirs[rir_idx])
IndexError: list index out of range
jmcasebeer commented 1 year ago

Hello and thanks for the question. Can you check that the dataset was able to find the rirs? Please run the code below and let me know the result. I've pasted the output when I run it on my machine.

import zoo.aec.aec as aec
dset = aec.MSFTAECDataset_RIR(mode="test", double_talk=False, scene_change=False)
print(f"Num. RIRs Found:{len(dset.rirs)} -- First RIR {dset.rirs[0]} -- Last RIR {dset.rirs[-1]}")

# The output
# Num. RIRs Found:500 -- First RIR /mnt/data/AEC/RIRS_NOISES/simulated_rirs/mediumroom/Room040/Room040-00054.wav -- Last RIR /mnt/data/AEC/RIRS_NOISES/simulated_rirs/largeroom/Room118/Room118-00017.wav
DeboBurro commented 1 year ago

hi @jmcasebeer thanks for responding.

Python 3.7.16 (default, Jan 17 2023, 22:20:44) 
[GCC 11.2.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import zoo.aec.aec as aec
>>> dset = aec.MSFTAECDataset_RIR(mode="test", double_talk=False, scene_change=False)
>>> print(f"Num. RIRs Found:{len(dset.rirs)} -- First RIR {dset.rirs[0]} -- Last RIR {dset.rirs[-1]}")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IndexError: list index out of range
>>> dset.rirs
[]
>>> dset.__dict__
{'farend_speech_dir': '/home/username/personal/dataset/AEC-Challenge/datasets/synthetic/farend_speech', 'nearend_speech_dir': '/home/username/personal/dataset/AEC-Challenge/datasets/synthetic/nearend_speech', 'double_talk': False, 'scene_change': False, 'random_roll': False, 'max_len': 160000, 'rir_len': None, 'rirs': [], 'mode': 'test', 'offset': 0}
jmcasebeer commented 1 year ago

Looks like the dataset isn't finding the RIRs. Can you check that they're unzipped and inside /home/username/personal/rirs_noises/RIRS_NOISES/?

The dataset grabs all the file names via:

import os
import glob2

RIR_DATA_DIR = "/home/username/personal/rirs_noises/RIRS_NOISES/"
rir_dir = os.path.join(RIR_DATA_DIR, "simulated_rirs/")
rirs = glob2.glob(rir_dir + "/**/*.wav")
DeboBurro commented 1 year ago
Python 3.7.16 (default, Jan 17 2023, 22:20:44) 
[GCC 11.2.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os 
>>> import glob2
>>> RIR_DATA_DIR = "/home/username/personal/dataset/rirs_noises/RIRS_NOISES/"
>>> rir_dir = os.path.join(RIR_DATA_DIR, "simulated_rirs/")
>>> rirs = glob2.glob(rir_dir + "/**/*.wav")
>>> rirs
['/home/username/personal/dataset/rirs_noises/RIRS_NOISES/simulated_rirs/largeroom/Room030/Room030-00032.wav', '/home/username/personal/dataset/rirs_noises/RIRS_NOISES/simulated_rirs/largeroom/Room030/Room030-00088.wav', 
.
.
]
jmcasebeer commented 1 year ago

Could you check that the path was correctly set in the config file? Looks like your data is setup right. You could also try manually passing in the RIR_DATA_DIR directly to the dataset.

from zoo.__config__ import RIR_DATA_DIR
print(RIR_DATA_DIR)

import zoo.aec.aec as aec
dset = aec.MSFTAECDataset_RIR(rir_dir="/home/username/personal/dataset/rirs_noises/RIRS_NOISES/", mode="test", double_talk=False, scene_change=False)
print(f"Num. RIRs Found:{len(dset.rirs)} -- First RIR {dset.rirs[0]} -- Last RIR {dset.rirs[-1]}")
DeboBurro commented 1 year ago
Python 3.7.16 (default, Jan 17 2023, 22:20:44) 
[GCC 11.2.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import zoo.aec.aec as aec
>>> from zoo.__config__ import RIR_DATA_DIR
>>> print(RIR_DATA_DIR)
/home/username/personal/dataset/rirs_noises/RIRS_NOISES/
>>> dset = aec.MSFTAECDataset_RIR(rir_dir="/home/username/personal/dataset/rirs_noises/RIRS_NOISES/", mode="test", double_talk=False, scene_change=False)
>>> print(f"Num. RIRs Found:{len(dset.rirs)} -- First RIR {dset.rirs[0]} -- Last RIR {dset.rirs[-1]}")
Num. RIRs Found:500 -- First RIR /home/username/personal/dataset/rirs_noises/RIRS_NOISES/simulated_rirs/largeroom/Room198/Room198-00030.wav -- Last RIR /home/username/personal/dataset/rirs_noises/RIRS_NOISES/simulated_rirs/smallroom/Room116/Room116-00081.wav

not sure why it's not populated properly when running the aec_eval.py but I right now manually put the rir_dir as the keyword when it instantiate the dataset object. And it works. thanks

          aec.MSFTAECDataset_RIR(
              rir_dir="/home/username/personal/dataset/rirs_noises/RIRS_NOISES/",
              mode="test",
              double_talk=False,
              scene_change=False,
              random_roll=kwargs["random_roll"],
              rir_len=eval_kwargs["true_rir_len"],
          )
jmcasebeer commented 1 year ago

Glad it works. You may also want to try the 1.0.1 models -- they should be better.