CoolFace
Modelpublic

TigreGotico/nisqa-onnx

sourceHugging Facecc-by-nc-sa-4.0updated 2mo agoView on Hugging Face
0likes
Model Card

NISQA (ONNX)

ONNX export of NISQAv2, the multi-dimensional no-reference speech quality model by Mittag et al. It predicts five perceptual quality dimensions from a single degraded speech signal, with no clean reference required.

This repository contains a derivative ONNX export of the model weights from [gabrielmittag/NISQA](https://github.com/gabrielmittag/NISQA) (weights/nisqa.tar).

Licence — read this first

NISQA is licensed in two parts, and they are not the same licence:

PartLicence
NISQA codeMIT (Copyright (c) 2021 Gabriel Mittag, Quality and Usability Lab, TU Berlin)
NISQA model weightsCC BY-NC-SA 4.0 — Attribution-NonCommercial-ShareAlike 4.0 International

The ONNX file in this repository is a derivative of the weights, so it inherits CC BY-NC-SA 4.0:

  • —NonCommercial — you may not use it for commercial purposes.
  • —ShareAlike — derivatives must be distributed under the same licence.
  • —Attribution — credit the original authors.

The upstream weights licence is included verbatim as `LICENSE_model_weights`. This repository is kept separate from our MIT-licensed metric models precisely so that the licence tag tells the truth.

Files

filesizenotes
nisqa.onnx1,054,416 bytesopset 17, single self-contained file

Input / output contract

The ONNX graph is the model only — the mel-spectrogram frontend and the segmentation are the caller's responsibility.

Input

nameshapedtype
segments[batch, n_segments, 1, 48, 15]float32

n_segments is a dynamic axis; variable-length audio works without re-export. Unlike upstream, the graph takes no `n_wins` input and expects no padding — feed exactly the real segments and every mask is implicitly all-true.

Frontend (must be reproduced exactly by the caller)

Mel-spectrogram, computed with librosa semantics:

parametervalue
sample ratenative — audio is not resampled (upstream uses librosa.load(sr=None))
n_fft4096
hop_lengthint(sr * 0.01) (10 ms)
win_lengthint(sr * 0.02) (20 ms)
windowhann, center=True, pad_mode='reflect'
power1.0 (magnitude, not power)
n_mels48
fmin / fmax0.0 / 20000
mel scalehtk=False (Slaney), norm='slaney'
dB conversionamplitude_to_db(S, ref=1.0, amin=1e-4, top_db=80.0)

Segmentation of the resulting [48, T] spectrogram:

parametervalue
seg_length15 frames (odd; the frame plus 7 neighbours each side)
seg_hop4
resulting shape[n_segments, 1, 48, 15], n_segments = ceil((T - 14) / 4)

No per-segment normalization is applied beyond the dB conversion above.

Output

nameshapedtype
scores[batch, 5]float32

The five values are, in this exact order:

indexdimensionmeaning
0mosOverall MOS (speech quality)
1noiNoisiness
2disDiscontinuity
3colColoration
4loudLoudness

All five are on the MOS scale (roughly 1–5). No post-processing or polynomial correction is required.

Export notes

Two upstream constructs do not survive a naive trace and were replaced with mathematically identical, shape-agnostic equivalents:

  • —F.adaptive_max_pool2d — not exportable when the input size is not statically visible. The three pools have architecturally fixed spatial sizes (48×15 → 24×7 → 12×5 → 6×3), so the adaptive windows are enumerated explicitly.
  • —nn.MultiheadAttention — traces to Reshape nodes with the trace-time sequence length baked in as a constant, which breaks the dynamic segment axis. NISQAv2 uses nhead=1, so it is replaced with a plain scaled dot-product attention over the packed in_proj weights.

Both were verified numerically against the unmodified upstream padded forward pass (which uses pack_padded_sequence and n_wins masking).

Verified parity

15 real speech clips spanning the quality range, plus a 1 s / 3 s / 10 s duration sweep exercising the dynamic axis. Maximum absolute deviation from the PyTorch reference, per dimension:

dimensionmax abs deviation
mos1.43e-06
noi9.54e-07
dis1.43e-06
col1.43e-06
loud9.54e-07
overall1.43e-06 (duration sweep: 1.91e-06)

Citation

bibtex
@inproceedings{mittag2021nisqa,
  title     = {{NISQA}: A Deep {CNN}-Self-Attention Model for Multidimensional
               Speech Quality Prediction with Crowdsourced Datasets},
  author    = {Mittag, Gabriel and Naderi, Babak and Chehadi, Assmaa and
               M{\"o}ller, Sebastian},
  booktitle = {Proc. Interspeech 2021},
  pages     = {2127--2131},
  year      = {2021},
  doi       = {10.21437/Interspeech.2021-299}
}

Upstream: <https://github.com/gabrielmittag/NISQA>