TigreGotico/nisqa-onnx
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:
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
Input / output contract
The ONNX graph is the model only — the mel-spectrogram frontend and the segmentation are the caller's responsibility.
Input
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:
Segmentation of the resulting [48, T] spectrogram:
No per-segment normalization is applied beyond the dB conversion above.
Output
The five values are, in this exact order:
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 toReshapenodes with the trace-time sequence length baked in as a constant, which breaks the dynamic segment axis. NISQAv2 usesnhead=1, so it is replaced with a plain scaled dot-product attention over the packedin_projweights.
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:
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>
