Rikorose / DeepFilterNet

Noise supression using deep filtering
https://huggingface.co/spaces/hshr/DeepFilterNet2
Other
2.4k stars 223 forks source link

prepare_data.py channel assertion #476

Closed markovivl closed 8 months ago

markovivl commented 9 months ago

Greetings! Thank you very much for your amazing work!

I am currently trying to better understand the pipeline, and already had a question. In the file prepare_data.py you have the following assertion

 def __getitem__(self, index):
        fn = self.file_names[index]
        logger.debug(f"Reading audio file {fn}")
        x = self.read(fn)
        assert x.dim() == 2 and x.shape[0] <= 16, f"Got sample {fn} with unexpected shape {x.shape}"
        n_samples = x.shape[1]
        x = encode(x, self.sr, self.codec, self.compression)
        return {"file_name": fn, "data": x, "n_samples": n_samples}

where you check that the number of channels in the input file is less than 16. In DNS4 dataset there are RIRs that have 30 channels.

  1. Did you use them or maybe you filtered them out?
  2. Can I simply cut 14 last channels from the sample and be satisfied with the end result if my purpose is to use the RIR for training?
Rikorose commented 9 months ago

You can just remove this line. This was just a workaround to make sure that the signal has 'channels first' shape and is not transposed.