ludlows / PESQ

PESQ (Perceptual Evaluation of Speech Quality) Wrapper for Python Users (narrow band and wide band)
https://github.com/ludlows/PESQ
MIT License
535 stars 98 forks source link

Validating results against Matlab implementation #3

Closed emil2099 closed 4 years ago

emil2099 commented 4 years ago

Hi - thanks so much for creating this. I have tried to validate results against Matlab implementation here by running it on the provided sample files:

from pesq import pesq
import librosa
sr = 8000
clean, sr = librosa.load('../data/eval_metric_test/sp09.wav', sr)
noisy, sr = librosa.load('../data/eval_metric_test/enhanced_logmmse.wav', sr)
pesq_mos = pesq(sr, clean, noisy, 'nb')
print(pesq_mos)

I am getting 1.862743616104126 as a result, against 2.2557 in the Readme of the Matlab implementation.

Would you happen to know the cause of the discrepancy?

ludlows commented 4 years ago

Hi Emil,

it seems you are using logmmse to enhance the audio quality.

you are able to use the following function to get Raw MOS score.

import math
def mapped_mos2raw_mos(mapped):
    return (math.log(4.0/(mapped - 0.999) - 1.0) - 4.6607) / (-1.4945)

and the value of mapped_mos2raw_mos(1.862743616104126) equals to 2.2557315831048843.

Hope it helps and thanks for using this pesq python code, ludlows

emil2099 commented 4 years ago

@ludlows wow - thanks very much for a prompt reply and explanation!