adobe-research / MetaAF

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

AEC Data Setup Issues #5

Closed jmcasebeer closed 2 years ago

jmcasebeer commented 2 years ago

I have downloaded the ''AEC-Challenge-main'' dataset and "RIRS_NOISES" dataset and I have set the paths in the config. I would like to try the AEC performance of Meta-AF using your pre-trained models. When I run this code which you tell in the tutorial: (!python /content/MetaAF/zoo/aec/aec.py --n_frames 1 --window_size 2048 --hop_size 1024 --n_in_chan 1 --n_out_chan 1 --is_real --n_devices 1 --batch_size 64 --total_epochs 1000 --val_period 10 --reduce_lr_patience 1 --early_stop_patience 4 --name meta_aec_demo --unroll 16 --extra_signals ude --random_roll --outer_loss log_self_mse --double_talk --dataset nonlinear) I will see 3 choices : wandb: (1) Create a W&B account wandb: (2) Use an existing W&B account wandb: (3) Don't visualize my results If I select 1 and after that register for a W&B account when I enter the wandb backend code. I received from the (wandb.errors.CommError: Permission denied, ask the project owner to grant you access) when I select 3 I will receive (RuntimeError: Error opening '/content/AEC-Challenge main/datasets/synthetic/farend_speech/farend_speech_fileid_0.wav': File contains data in an unknown format.) Could you please help me to solve this error?

Originally posted by @Alirezanezamdoost in https://github.com/adobe-research/MetaAF/issues/4#issuecomment-1197914301

jmcasebeer commented 2 years ago

Hey @Alirezanezamdoost, thanks for the extra info!

For the W&B error, I just pushed a change that should let you select option 1.

For the "file contains data in an unknown format" error, could you try directly reading a file from the AEC dataset? Something like:

import soundfile as sf
sf.read('/content/AEC-Challenge main/datasets/synthetic/farend_speech/farend_speech_fileid_0.wav')
Alirezanezamdoost commented 2 years ago

Thank you for your kind consideration. I am reading a file from the AEC dataset and it was working and I think it is not related to the dataset. But still, I have the problem of "file contains data in an unknown format" when I select option 1.

jmcasebeer commented 2 years ago

Does loading from the dataset/dataloader work? Something like:

dset = aec.MSFTAECDataset_RIR(mode='test', double_talk=True, random_roll=True, scene_change=False) 
data = dset[0]

If not, could you please include the full stack trace of the error?

Alirezanezamdoost commented 2 years ago

Thank you for your reply.

{'b1': 0.99, 'batch_size': 64, 'dataset': 'linear', 'double_talk': True, 'early_stop_patience': 4, 'extra_signals': 'ude', 'h_size': 32, 'hop_size': 1024, 'input_transform': 'log1p', 'is_real': True, 'lam_1': 0.01, 'n_devices': 1, 'n_frames': 1, 'n_in_chan': 1, 'n_layers': 2, 'n_out_chan': 1, 'name': 'auto_rls_16_dt_c', 'optimizer': 'gru', 'outer_loss': 'log_self_mse', 'pad_size': 0, 'random_roll': True, 'reduce_lr_patience': 1, 'scene_change': False, 'total_epochs': 1000, 'unroll': 16, 'val_period': 10, 'window_size': 2048}

RuntimeError Traceback (most recent call last) in () 39 #dset = aec.MSFTAECDataset_RIR(mode='test', double_talk=True, random_roll=True, scene_change=False) 40 dset = aec.MSFTAECDataset_RIR(mode='test', double_talk=True, random_roll=True, scene_change=True) ---> 41 data = dset[0]

5 frames /content/MetaAF/zoo/aec/aec.py in getitem(self, idx) 282 283 def getitem(self, idx): --> 284 data_dict = self.load_from_idx(idx) 285 286 if self.scene_change:

/content/MetaAF/zoo/aec/aec.py in load_from_idx(self, idx) 237 u, sr = sf.read( 238 os.path.join( --> 239 self.farend_speech_dir, f"farend_speechfileid{speech_idx}.wav" 240 ) 241 )

/usr/local/lib/python3.7/dist-packages/soundfile.py in read(file, frames, start, stop, dtype, always_2d, fill_value, out, samplerate, channels, format, subtype, endian, closefd) 255 """ 256 with SoundFile(file, 'r', samplerate, channels, --> 257 subtype, endian, format, closefd) as f: 258 frames = f._prepare_read(start, stop, frames) 259 data = f.read(frames, dtype, always_2d, fill_value, out)

/usr/local/lib/python3.7/dist-packages/soundfile.py in init(self, file, mode, samplerate, channels, subtype, endian, format, closefd) 627 self._info = _create_info_struct(file, mode, samplerate, channels, 628 format, subtype, endian) --> 629 self._file = self._open(file, mode_int, closefd) 630 if set(mode).issuperset('r+') and self.seekable(): 631 # Move write position to 0 (like in Python file objects)

/usr/local/lib/python3.7/dist-packages/soundfile.py in _open(self, file, mode_int, closefd) 1182 raise TypeError("Invalid file: {0!r}".format(self.name)) 1183 _error_check(_snd.sf_error(file_ptr), -> 1184 "Error opening {0!r}: ".format(self.name)) 1185 if mode_int == _snd.SFM_WRITE: 1186 # Due to a bug in libsndfile version <= 1.0.25, frames != 0

/usr/local/lib/python3.7/dist-packages/soundfile.py in _error_check(err, prefix) 1355 if err != 0: 1356 err_str = _snd.sf_error_number(err) -> 1357 raise RuntimeError(prefix + _ffi.string(err_str).decode('utf-8', 'replace')) 1358 1359

RuntimeError: Error opening '/content/AEC-Challenge-main/datasets/synthetic/farend_speech/farend_speech_fileid_0.wav': File contains data in an unknown format.

jmcasebeer commented 2 years ago

And you confirmed that you can directly sf.read() that same file in the same environment?

dset = aec.MSFTAECDataset_RIR(mode='test', double_talk=True, random_roll=True, scene_change=True)
sf.read('/content/AEC-Challenge-main/datasets/synthetic/farend_speech/farend_speech_fileid_0.wav')
data = dset[0]

Does the dataset crash for all indices or just index 0? Can you check some other index likedset[42]?

Alirezanezamdoost commented 2 years ago

I can not read all files in the far-end speech like "farend_speech/farend_speech_fileid_0.wav" but the others like '/content/AEC-Challenge-main/baseline/icassp2021/clean/0YP1nl3pDk6paW0ZYAPdpg_doubletalk.wav' is runnable. All the farend and naerend is not readable.

jmcasebeer commented 2 years ago

Seems like an issue with the Microsoft AEC challenge dataset download. How large is the synthetic dataset fold? Did it get fully Downloaded?

I am happy to help but the folks that host the challenge dataset may be more useful.

Alirezanezamdoost commented 2 years ago

I have downloaded the Microsoft AEC challenge dataset completely. I tried to play the farend and nearend with the player on the laptop but it did not work correctly. I think the dataset has crashed. I have run your code directly on Colab and given them all the path truly. At this time what do I have to do to gain the result? do you have any suggestions or other paths to take the dataset? Do you know why the dataset does not work at this time? Is there a problem with the host?

jmcasebeer commented 2 years ago

If you want to train the model, you first need the dataset. It sounds like something went wrong with your download. You should be able to listen to the farend and nearend samples without issue. You can get help with downloading the dataset here. I don't maintain or host the dataset.

If you just want to evaluate the models, I released model checkpoints here.