espnet2.enh.layers.beamformer.get_rtf
Less than 1 minute
espnet2.enh.layers.beamformer.get_rtf
espnet2.enh.layers.beamformer.get_rtf(psd_speech, psd_noise, mode='power', reference_vector: int | Tensor = 0, iterations: int = 3)
Calculate the relative transfer function (RTF)
Algorithm of power method: : 1. rtf = reference_vector 2. for i in range(iterations): : rtf = (psd_noise^-1 @ psd_speech) @ rtf rtf = rtf / ||rtf||_2 # this normalization can be skipped 3. rtf = psd_noise @ rtf 4. rtf = rtf / rtf[…, ref_channel, :]
Note: 4) Normalization at the reference channel is not performed here.
- Parameters:
- psd_speech (torch.complex64/ComplexTensor) – speech covariance matrix (…, F, C, C)
- psd_noise (torch.complex64/ComplexTensor) – noise covariance matrix (…, F, C, C)
- mode (str) – one of (“power”, “evd”) “power”: power method “evd”: eigenvalue decomposition
- reference_vector (torch.Tensor or int) – (…, C) or scalar
- iterations (int) – number of iterations in power method
- Returns: (…, F, C, 1)
- Return type: rtf (torch.complex64/ComplexTensor)