Rikorose / DeepFilterNet

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

Unable to train on 16k data #288

Closed JBloodless closed 1 year ago

JBloodless commented 1 year ago

Hi,

I'm trying to retrain the model on 16khz data. I've set parameters in config.inias

sr = 16000
fft_size = 480
hop_size = 240
nb_erb = 16
nb_df = 48
min_nb_erb_freqs = 1

but at the start of the training I'm getting a bunch of

thread 'DataLoader Worker 7' panicked at 'assertion failed: `(left == right)` 
left: `16000`,
right: `48000`: bw_filterbank() assumes 48 kHz sampling rate.', libDF/src/transforms.rs:520:5

I used prepare_data.py --sr 16000 on all of my datasets tho

In transforms.rs I see

/// Estimate bandwidth by finding the highest frequency bin containing a sufficient amount of energy.
/// A minimum sampling rate of 16 kHz is assumed.

but assertion seems to be hardcoded:

pub(crate) fn estimate_bandwidth(
    input: ArrayView3<Complex32>,
    sr: usize,
    mut db_cut_off: f32,
    mut window_size: usize,
) -> usize {
    assert_eq!(sr, 48000, "bw_filterbank() assumes 48 kHz sampling rate.");

What am I doing wrong or what should I change? Thanks in advance.

Rikorose commented 1 year ago

The bandwidth extension only supports upsampling from down to 16khz to 48kHz. This does not make sense if your model sampling rate is 16k. Try without bandwidth extension.

JBloodless commented 1 year ago

Oh, thanks! Completely forgot about this setting in config.

zzgnb commented 3 months ago

Have you ever trained a 16k version of DF successfully? I got a significant performance gap between 16k model and the original model. Could you please give me some suggestion about configuration or some changes in code?