espnet2.enh.separator.ineube_separator.iNeuBe
espnet2.enh.separator.ineube_separator.iNeuBe
class espnet2.enh.separator.ineube_separator.iNeuBe(n_spk=1, n_fft=512, stride=128, window='hann', mic_channels=1, hid_chans=32, hid_chans_dense=32, ksz_dense=(3, 3), ksz_tcn=3, tcn_repeats=4, tcn_blocks=7, tcn_channels=384, activation='elu', output_from='dnn1', n_chunks=3, freeze_dnn1=False, tik_eps=1e-08)
Bases: AbsSeparator
iNeuBe, iterative neural/beamforming enhancement
Reference: Lu, Y. J., Cornell, S., Chang, X., Zhang, W., Li, C., Ni, Z., … & Watanabe, S. Towards Low-Distortion Multi-Channel Speech Enhancement: The ESPNET-Se Submission to the L3DAS22 Challenge. ICASSP 2022 p. 9201-9205.
NOTES: As outlined in the Reference, this model works best when coupled with the MultiResL1SpecLoss defined in criterions/time_domain.py. The model is trained with variance normalized mixture input and target. e.g. with mixture of shape [batch, microphones, samples] you normalize it by dividing with torch.std(mixture, (1, 2)). You must do the same for the target signal. In the Reference, the variance normalization was performed offline (we normalized by the std computed on the entire training set and not for each input separately). However we found out that also normalizing each input and target separately works well.
- Parameters:
- n_spk – number of output sources/speakers.
- n_fft – stft window size.
- stride – stft stride.
- window – stft window type choose between ‘hamming’, ‘hanning’ or None.
- mic_channels – number of microphones channels (only fixed-array geometry supported).
- hid_chans – number of channels in the subsampling/upsampling conv layers.
- hid_chans_dense – number of channels in the densenet layers (reduce this to reduce VRAM requirements).
- ksz_dense – kernel size in the densenet layers thorough iNeuBe.
- ksz_tcn – kernel size in the TCN submodule.
- tcn_repeats – number of repetitions of blocks in the TCN submodule.
- tcn_blocks – number of blocks in the TCN submodule.
- tcn_channels – number of channels in the TCN submodule.
- activation – activation function to use in the whole iNeuBe model, you can use any torch supported activation e.g. ‘relu’ or ‘elu’.
- output_from – output the estimate from ‘dnn1’, ‘mfmcwf’ or ‘dnn2’.
- n_chunks – number of future and past frames to consider for mfMCWF computation.
- freeze_dnn1 – whether or not freezing dnn1 parameters during training of dnn2.
- tik_eps – diagonal loading in the mfMCWF computation.
Initializes internal Module state, shared by both nn.Module and ScriptModule.
forward(input: Tensor | ComplexTensor, ilens: Tensor, additional: Dict | None = None) → Tuple[List[Tensor | ComplexTensor], Tensor, OrderedDict]
Forward.
Parameters:
- input (torch.Tensor/ComplexTensor) – batched multi-channel audio tensor with C audio channels and T samples [B, T, C]
- ilens (torch.Tensor) – input lengths [Batch]
- additional (Dict or None) – other data, currently unused in this model.
Returns: [(B, T), …] list of len n_spk : of mono audio tensors with T samples.
ilens (torch.Tensor): (B,) additional (Dict or None): other data, currently unused in this model,
we return it also in output.
Return type: enhanced (List[Union[torch.Tensor, ComplexTensor]])
static mfmcwf(mixture, estimate, n_chunks, tik_eps)
multi-frame multi-channel wiener filter.
- Parameters:
- mixture (torch.Tensor) – multi-channel STFT complex mixture tensor, of shape [B, T, C, F] batch, frames, microphones, frequencies.
- estimate (torch.Tensor) – monaural STFT complex estimate of target source [B, T, F] batch, frames, frequencies.
- n_chunks (int) – number of past and future mfMCWF frames. If 0 then standard MCWF.
- tik_eps (float) – diagonal loading for matrix inversion in MCWF computation.
- Returns: monaural STFT complex estimate : of target source after MFMCWF [B, T, F] batch, frames, frequencies.
- Return type: beamformed (torch.Tensor)
property num_spk
static pad2(input_tensor, target_len)
static unfold(tf_rep, chunk_size)
unfolding STFT representation to add context in the mics channel.
- Parameters:
- mixture (torch.Tensor) – 3D tensor (monaural complex STFT) of shape [B, T, F] batch, frames, microphones, frequencies.
- n_chunks (int) – number of past and future to consider.
- Returns: complex 3D tensor STFT with context channel. : shape now is [B, T, C, F] batch, frames, context, frequencies. Basically same shape as a multi-channel STFT with C microphones.
- Return type: est_unfolded (torch.Tensor)