Closed Shin-ichi-Takayama closed 2 years ago
This is indeed a good question! I don't think splitting the file is the correct way to do it.
In your case, you have access to both the clean speech and the noise, so the best is to use both as references.
from scipy.io import wavfile
import numpy as np
import fast_bss_eval
# assume all files are mono
_, speech_ref = wavfile.read("./data/ref.wav")
_, noise_ref = wavfile.read("./data/noise.wav")
_, est = wavfile.read("./data/est.wav")
ref = np.stack([speech_ref, noise_ref], axis=0)
# I think it should work also with `est[None, ...]`, but to be sure make est
# the same number of channels as ref
est =np.stack([est, est], axis=0)
# compute the metrics
sdr, sir, sar = fast_bss_eval.bss_eval_sources(ref, est, compute_permutation=False)
print('sdr:', sdr[0])
print('sir:', sir[0])
print('sar:', sar[0])
Thank you for your response. I was able to evaluate the SIR and SDR with a mono wav file.
Hello.
I have a question about how to evaluate SIR and SDR for mono wav file. How do I evaluate SIR and SDR for mono wav files?
I have the following mono wav files.
The length of the wav file is 4 seconds. The sampling frequency is 16k Hz. I calculated the SIR of the mono wav file and it was Inf. As I asked in Issue #12, the SIR was Inf for the following code.
However, I would like to evaluate the SIR with a mono wav file. To avoid the SIR to be Inf, I divided the wav file into 4 parts. Is the following code able to evaluate SIR and SDR correctly?
What signals are needed for each channel of ref and est? Best regards.