STOI (Short-time objective intelligibility) is a prediction metric useful to replace previous objective prediction measures.
I tried to check if the Matlab and Python versions of STOI codes work equally with the identical output scores.
The Matlab code is available from Cees Taal's web site.
The python version is available from Pariente Manuel's GitHub.
The same processed wav file and reference wav file are tested using Matlab and Python.
The Python version needs a few configurations.
Create minicoda environments
conda create -n py38_STOI python=3.8 pytorch
conda activate py38_STOI
Install sound packages
pip install SoundFileInstall sound packages
conda install -c conda-forge librosa
Run the python file.
python STOI_test.py
where the STOI_test.py is modified from Pariente Manuel's GitHub:
import soundfile as sf
from pystoi import stoi #or use from pystoi.stoi import stoi
clean, fs = sf.read('my_clean.wav')
denoised, fs = sf.read('my_processed.wav')
# Clean and den should have the same length, and be 1D
d = stoi(clean, denoised, fs, extended=False)
print(d)
0.8157936197843473
The result of Matlab version is
>> d = stoi(y_my_clean, y_my_processed, fs)
d =
0.8158
The results are similar, but there is still a tiny difference when showing more decimal points using digits() and vpa() commands.
>> digits(16)
>> vpa(d)
ans =
0.8157974711433416
The difference between Matlab and Python versions is small than 0.00001 and hence can be ignored.
References:
Cees Taal's web site
Pariente Manuel's GitHub
沒有留言:
張貼留言