in evaluate.py [0:0]
def compute_metrics(binauralized, reference):
'''
compute l2 error, amplitude error, and angular phase error for the given binaural and reference singal
:param binauralized: 2 x T tensor containing predicted binaural signal
:param reference: 2 x T tensor containing reference binaural signal
:return: errors as a scalar value for each metric and the number of samples in the sequence
'''
binauralized, reference = binauralized.unsqueeze(0), reference.unsqueeze(0)
# compute error metrics
l2_error = L2Loss()(binauralized, reference)
amplitude_error = AmplitudeLoss(sample_rate=48000)(binauralized, reference)
phase_error = PhaseLoss(sample_rate=48000, ignore_below=0.2)(binauralized, reference)
return{
"l2": l2_error,
"amplitude": amplitude_error,
"phase": phase_error,
"samples": binauralized.shape[-1]
}