Spectral Convergence Loss
SpectralConvergengeLoss
Bases: Module
Spectral convergence loss module. Spectral convergence loss is a measure of the similarity between two magnitude spectrograms.
The spectral convergence loss is calculated as the Frobenius norm of the difference between the predicted and groundtruth magnitude spectrograms, divided by the Frobenius norm of the groundtruth magnitude spectrogram. The Frobenius norm is a matrix norm that is equivalent to the square root of the sum of the squared elements of a matrix.
The spectral convergence loss is a useful metric for evaluating the quality of a predicted signal, as it measures the degree to which the predicted signal matches the groundtruth signal in terms of its spectral content. A lower spectral convergence loss indicates a better match between the predicted and groundtruth signals.
Source code in training/loss/spectral_convergence_loss.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
|
__init__()
Initilize spectral convergence loss module.
Source code in training/loss/spectral_convergence_loss.py
14 15 16 |
|
forward(x_mag, y_mag)
Calculate forward propagation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x_mag |
Tensor
|
Magnitude spectrogram of predicted signal (B, #frames, #freq_bins). |
required |
y_mag |
Tensor
|
Magnitude spectrogram of groundtruth signal (B, #frames, #freq_bins). |
required |
Returns:
Name | Type | Description |
---|---|---|
Tensor |
Tensor
|
Spectral convergence loss value. |
Source code in training/loss/spectral_convergence_loss.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
|