AI Logic

Evaluation Metrics

MOSNet

Updated:

Structure and training of MOSNet. On the left, the magnitude spectrogram of the speech under test passes through a convolution block repeated 4 times, a BLSTM, and two fully connected layers to produce frame-level scores, which are averaged over time to predict the utterance MOS. On the right, a graph of the frame-level scores, their mean, and the true MOS; the objective function that sums the utterance error and the frame error; and a table of correlation coefficients between humans and for MOSNet

Background and overview

MOSNet is a neural network that predicts the score people give after listening to speech (MOS, the mean opinion score from 1 to 5) from the speech alone. Lo et al. proposed it in 2019 for evaluating voice conversion (technology that changes one person's voice into another's). Given the speech to be evaluated, it outputs a single predicted score from 1 to 5.

The quality of voice conversion and speech synthesis is ultimately evaluated by people listening and giving a MOS. Listening tests, however, require many listeners and cost time and money. Mel-cepstral distortion (MCD), which had been used as an automatic metric, measures distortion in acoustic features and does not necessarily match human perception. Metrics such as PESQ also need correct speech (a reference) to compare against. Converted voices often have no exactly matching correct speech, so these metrics cannot be used as is.

MOSNet tackled this problem by training on the results of the large-scale listening test of the voice conversion challenge VCC 2018 (MOS for about 20,000 utterances) and predicting human MOS without reference speech. According to the paper, it is the first deep-learning-based quality assessment model for voice conversion.

Model and training

MOSNet predicts MOS through the following steps. The paper compared three variants, CNN, BLSTM, and CNN-BLSTM, and CNN-BLSTM gave the best utterance-level correlation. The left side of the figure at the top shows the structure of this CNN-BLSTM.

  1. Resample the speech to 16 kHz, apply a short-time Fourier transform with a 512-point (32 ms) window shifted by 256 points (16 ms), and stack a 257-dimensional magnitude spectrum per frame (NN frames × 257).
  2. Stack 4 blocks, each made of three 3 × 3 convolution layers (12 layers in total, with 16, 32, 64, and 128 channels per block). Only the third layer of each block shrinks the frequency axis to 1/3. The region one point in the last layer sees (its receptive field) spans 25 frames (about 400 ms).
  3. A bidirectional LSTM (BLSTM, 128 units) summarizes the temporal context in both directions.
  4. Two fully connected layers (a 128-unit layer with ReLU and dropout, then a 1-unit layer) output a frame-level score qtq_t.
  5. The frame-level scores are averaged over time to give the predicted utterance MOS QQ.

Training treats MOS prediction as a regression problem and minimizes the following objective.

O=1S∑s=1S[(Q^s−Qs)2+αTs∑t=1Ts(Q^s−qs,t)2]O = \frac{1}{S} \sum_{s=1}^{S} \left[ \left( \hat{Q}_s - Q_s \right)^2 + \frac{\alpha}{T_s} \sum_{t=1}^{T_s} \left( \hat{Q}_s - q_{s,t} \right)^2 \right]

Q^s\hat{Q}_s is the true MOS of the ss-th utterance (the mean of four listeners' scores), QsQ_s is its prediction, qs,tq_{s,t} is the score of frame tt, TsT_s is the number of frames, and SS is the number of utterances. The first term is the utterance-level mean squared error, and the second term pulls every frame's score toward the utterance's true MOS. Because the quality of converted speech does not vary much between frames, the paper set the weight α\alpha to 1.

The second term prevents a state where "frame-level scores can scatter freely as long as the utterance average is right." As an analogy, it is like coaching not only the class average but each student's score toward the target. In the paper, removing this term made the frame-level scores fluctuate strongly, and the utterance-level correlation dropped from 0.642 to 0.560.

Training used a dropout rate of 0.3, Adam (learning rate 0.0001), no batch normalization, and early stopping on validation MSE (5 epochs). The 20,580 utterances were split into 13,580 for training, 3,000 for validation, and 4,000 for testing.

What it measures and its limitations

MOSNet infers from the spectrogram how natural the VCC 2018 listeners judged a voice to be. Rather than comparing against correct speech, it is easiest to think of it as having learned what natural-sounding speech looks like from a large number of "speech and score" pairs seen in training.

It also has the following limitations.

  • Per-utterance predictions are coarse: The four listeners' scores for the same utterance varied widely to begin with; about half the utterances had a standard deviation above 1. When the paper used bootstrapping (re-sampling half of the listeners and averaging, repeated 1,000 times), the correlation between the MOS from half the listeners and from all listeners was 0.805 at the utterance level and 0.994 at the system level. Since even humans agree only to a limited degree per utterance, the prediction also reaches only 0.642 at the utterance level.
  • It rarely outputs extreme scores: Because the MOS in the training data clusters around 3, predictions also cluster mainly in 1.5–3.5 and rarely give low or high scores. The paper describes this as a common limitation of training with MSE on data close to a normal distribution.
  • It depends on the range of the training data: The model was trained on English speakers and voice conversion systems from VCC 2018. It kept a correlation of 0.917 for system-level predictions on another challenge (VCC 2016), but it is not guaranteed to work on speech with very different recording conditions, languages, or synthesis methods.
  • Speaker similarity must be measured separately: In voice conversion, "how similar the voice is to the target speaker" also matters. The paper tried a variant that takes two utterances and predicts their similarity, but its utterance-level correlation was 0.453, still a rough result.

MOSNet scores are reliable when comparing systems (models) by their average over many utterances. Judging a single utterance by its MOSNet score alone, or applying it to speech very different from the training data (another language, noisy recordings, and so on), can diverge from human ratings. Use human listening tests as well for the final evaluation.

Validation in the original paper

The paper measured the correlation between predictions and human MOS on the VCC 2018 test data (4,000 utterances) using the Pearson linear correlation coefficient (LCC), the Spearman rank correlation coefficient (SRCC), and MSE. It made two kinds of comparison: per utterance, and per system, comparing the averages over each system's utterances. The table below shows the main results for different batch sizes (the subscript numbers).

ModelUtterance LCCUtterance SRCCSystem LCCSystem SRCC
BLSTM (batch 1, same structure as the earlier Quality-Net)0.5110.4840.8260.808
BLSTM (batch 64)0.2510.2540.4120.427
CNN (batch 1)0.6380.5870.9450.875
CNN-BLSTM (batch 64)0.6420.5890.9570.888
Reference: human vs. human (half of the listeners vs. all)0.8050.8060.9940.978

CNN-BLSTM reached a system-level LCC of 0.957, close to the human-vs-human value of 0.994. The BLSTM-only model degraded sharply with larger batches; the paper attributes this to the zeros added to equalize lengths disturbing the prediction. Models with a CNN were stable across batch sizes.

Where it is used

MOSNet is mainly used in the following situations.

  • Comparing voice conversion and speech synthesis systems: Before a listening test, it automatically compares many systems and settings to narrow down the candidates.
  • Checking progress during training: Applying MOSNet to the outputs of a model in training is an easy way to see whether naturalness is improving.
  • Evaluation without reference speech: It can evaluate synthesized speech and converted voices, where metrics that compare against correct speech, such as PESQ and STOI, cannot be used.

After MOSNet, methods appeared that predict MOS using speech models pretrained with self-supervised learning. UTMOS is one of them and ranked first in several evaluation categories of a MOS prediction competition (VoiceMOS Challenge 2022).

Comparison with similar metrics

The following table compares speech quality metrics from the same perspectives.

MetricReference speechWhat it measuresRange and directionHow it is computed
MOSNot required (in ACR, where listeners rate each sample individually)Subjective quality (how it sounds to people)1 to 5. Higher is betterMean of listener ratings
MOSNetNot requiredPrediction of human MOS (naturalness of voice conversion)Roughly 1 to 5. Higher is betterPredicted by a CNN-BLSTM (trained on VCC 2018)
UTMOSNot requiredPrediction of human MOS (naturalness of synthesized speech)Roughly 1 to 5. Higher is betterEnsemble of predictions from fine-tuned pretrained speech models
PESQRequired (full reference)Perceptual quality (degradation as heard over the telephone)About 1.0 to 4.6 when mapped to MOS-LQO. Higher is betterComparison through an auditory model
STOIRequired (full reference)Intelligibility (whether the words can be understood)Roughly 0 to 1. Higher is betterCorrelation of envelopes over short segments
SI-SDRRequired (full reference)Waveform distortiondB. Higher is betterFormula based on inner products and energies

Rough guidelines for choosing among them:

  • To compare synthesized or converted speech quickly without a reference: Use a MOS predictor such as MOSNet or UTMOS. The closer the speech is to the predictor's training data, the more trustworthy the results.
  • To show final quality: Predictions cannot fully replace human ratings, so measure human MOS.
  • For noise suppression or speech separation where correct speech exists: Use full-reference metrics such as PESQ, STOI, and SI-SDR.

PyTorch example

Show code
python
import torch
import torch.nn as nn


class MOSNet(nn.Module):
  """CNN-BLSTM from Table 2 of Lo et al. (2019). Input is a (B, N, 257) magnitude spectrogram
  (16 kHz, 512-point STFT with a hop of 256). Output is the frame-level scores and their mean (utterance MOS)."""

  def __init__(self, dropout=0.3):
    super().__init__()
    layers, c_in = [], 1
    for c in [16, 32, 64, 128]:
      layers += [
        nn.Conv2d(c_in, c, 3, padding=1), nn.ReLU(),
        nn.Conv2d(c, c, 3, padding=1), nn.ReLU(),
        nn.Conv2d(c, c, 3, stride=(1, 3), padding=1), nn.ReLU(),  # shrink only the frequency axis to 1/3
      ]
      c_in = c
    self.cnn = nn.Sequential(*layers)  # frequency: 257 → 86 → 29 → 10 → 4
    self.blstm = nn.LSTM(128 * 4, 128, batch_first=True, bidirectional=True)
    self.fc = nn.Sequential(
      nn.Linear(256, 128), nn.ReLU(), nn.Dropout(dropout),  # Dropout is active only in model.train()
      nn.Linear(128, 1),
    )

  def forward(self, spec, mask):
    # spec: (B, N, 257), mask: (B, N). Frames added as padding are 0
    h = self.cnn(spec.unsqueeze(1))              # (B, 128, N, 4)
    h = h.permute(0, 2, 1, 3).flatten(2)         # (B, N, 512)
    h, _ = self.blstm(h)                         # (B, N, 256)
    q = self.fc(h).squeeze(-1)                   # (B, N): frame-level scores q_t
    Q = (q * mask).sum(1) / mask.sum(1)          # mean excluding padded frames: utterance MOS
    return Q, q


def mosnet_loss(Q, q, mos, mask, alpha=1.0):
  """Eq. (1): average (true - Q)^2 + alpha / T * sum_t (true - q_t)^2 over utterances. mos is the true MOS."""
  utt = (mos - Q) ** 2
  frame = (((mos[:, None] - q) ** 2) * mask).sum(1) / mask.sum(1)
  return (utt + alpha * frame).mean()


model = MOSNet()
optimizer = torch.optim.Adam(model.parameters(), lr=1e-4)

# For prediction: call model.eval() to disable dropout
# model.eval()
# with torch.no_grad():
#   Q, _ = model(spec, mask)

FAQ

Q. Can MOSNet scores be treated as the same thing as human MOS?
A.

No. System-level averages agreed with human MOS at a correlation of 0.957, but per utterance the correlation is only 0.642. Predictions also cluster mainly in 1.5–3.5 and tend not to produce extreme scores. Use it as a guide for comparing systems, and measure human MOS for the final evaluation.

Q. Why does the objective also include the frame-level error?
A.

If only the utterance average is matched, the error stays small even when frame-level scores fluctuate strongly, which makes predictions unstable. Adding a term that pulls every frame's score toward the utterance's true MOS raised the utterance-level correlation from 0.560 to 0.642 in the paper.

Q. How do MOSNet and UTMOS differ?
A.

MOSNet learns a CNN and BLSTM from scratch on magnitude spectrograms, using data from a voice conversion listening test (VCC 2018). UTMOS fine-tunes models such as wav2vec 2.0 that were pretrained on large amounts of speech, adds listener identity as an input, and combines the predictions of several models. Neither needs reference speech.

References

  1. Lo, C.-C., Fu, S.-W., Huang, W.-C., Wang, X., Yamagishi, J., Tsao, Y., & Wang, H.-M. (2019). MOSNet: Deep Learning-based Objective Assessment for Voice Conversion. Interspeech 2019. arXiv:1904.08352.
  2. Fu, S.-W., Tsao, Y., Hwang, H.-T., & Wang, H.-M. (2018). Quality-Net: An End-to-End Non-intrusive Speech Quality Assessment Model based on BLSTM. Interspeech 2018. arXiv:1808.05344.
  3. Saeki, T., Xin, D., Nakata, W., Koriyama, T., Takamichi, S., & Saruwatari, H. (2022). UTMOS: UTokyo-SaruLab System for VoiceMOS Challenge 2022. Interspeech 2022. arXiv:2204.02152.