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 (weights/nisqa.tar).

Licence — read this first

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

Part Licence
NISQA code MIT (Copyright (c) 2021 Gabriel Mittag, Quality and Usability Lab, TU Berlin)
NISQA model weights CC 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

file size notes
nisqa.onnx 1,054,416 bytes opset 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

name shape dtype
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:

parameter value
sample rate native — audio is not resampled (upstream uses librosa.load(sr=None))
n_fft 4096
hop_length int(sr * 0.01) (10 ms)
win_length int(sr * 0.02) (20 ms)
window hann, center=True, pad_mode='reflect'
power 1.0 (magnitude, not power)
n_mels 48
fmin / fmax 0.0 / 20000
mel scale htk=False (Slaney), norm='slaney'
dB conversion amplitude_to_db(S, ref=1.0, amin=1e-4, top_db=80.0)

Segmentation of the resulting [48, T] spectrogram:

parameter value
seg_length 15 frames (odd; the frame plus 7 neighbours each side)
seg_hop 4
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

name shape dtype
scores [batch, 5] float32

The five values are, in this exact order:

index dimension meaning
0 mos Overall MOS (speech quality)
1 noi Noisiness
2 dis Discontinuity
3 col Coloration
4 loud Loudness

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:

dimension max abs deviation
mos 1.43e-06
noi 9.54e-07
dis 1.43e-06
col 1.43e-06
loud 9.54e-07
overall 1.43e-06 (duration sweep: 1.91e-06)

Citation

@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

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Collection including TigreGotico/nisqa-onnx