Closed MinMolang closed 4 years ago
PESQ results principally model mean opinion scores (MOS) that cover a scale from 1 (bad) to 5 (excellent). A mapping function to MOS-LQO is outlined under P.862.1
Standard implementation in pesqmain.c
(C code)
P.862: Software/P862_annex_A_2005_CD/source/pesqmain.c
if ( err_info->mode == NB_MODE )
{
err_info->mapped_mos = 0.999f+4.0f/(1.0f+(float)exp((-1.4945f*err_info->pesq_mos+4.6607f)));
}
else
{
err_info->mapped_mos = 0.999f+4.0f/(1.0f+(float)exp((-1.3669f*err_info->pesq_mos+3.8224f)));
err_info->pesq_mos = -1.0;
}
Little experiment (correction is highly appreciated if I made any mistake!)
import numpy as np
def mapping(pesq_value, mode='NB'):
if mode == 'NB':
return 0.999 + 4.0 / (1.0 + np.exp(-1.4945 * pesq_value + 4.6607))
else:
return 0.999 + 4.0 / (1.0 + np.exp(-1.3669 * pesq_value + 3.8224))
nb_min, nb_max = mapping(-0.5, 'NB'), mapping(4.5, 'NB')
wb_min, wb_max = mapping(-0.5, 'WB'), mapping(4.5, 'WB')
print(f'NB range: ({nb_min}, {nb_max})')
print(f'WB range: ({wb_min}, {wb_max})')
Result
NB range: (1.016843313292765, 4.548638319075995)
WB range: (1.0426942267891948, 4.643888749336258)
Thank you for let me know NB range and WB range! And I checked P.862.1 in here https://www.itu.int/rec/T-REC-P.862.1-200311-I/en And It said "In addition, the mapping ensures a domain rescaling from –0.5 ... 4.5 to 1.02 ... 4.56. " So now I understand this range is not exactly 1.0 to 4.5. I totally didn't know about P.862 or MOS-LQO these things..! My result is exactly same with @leo19941227 's result. So I will keep in mind that this is P.862.2! Thanks. XD
I am sorry for a small mistake. Actually the code is provided in P.862, however it did follow the mapping function described in P862.1 and P862.2 when it was amended in P862 Amendment 2.
In conclusion, P862.1 proposes a mapping function for narrow band raw pesq value -> MOS-LQO, and P862.2 proposes another one for the wide band case. They are two similar but different mapping functions. Finally, P.862 Amendment 2 implements these two functions in C code.
At the present moment i'm using your code for PESQ, but can someone help me with usage of narrow band and wide band in the code, like why we use nb and wb?
@arunraj-sandeza thanks for using our code.
regarding your question, the narrow and wide bands are distinguished by the upper frequency bound. the narrow band has a lower frequancy bound 8000Hz. while the wide one has a higher bound 16000Hz. in other words, we could use the sampling rate of your raw audio samples to help you choose the mode.
what is the smallest value of pesq?
I have tasted with two same audio wave files.(16khz) I got result like this.
I thought that max PESQ would be 4.5. I'd like to know the python-PESQ max value. I appreciate your pyhon-pesq module. Thanks. XD