This release is a pre-release and may not be stable for production use.
speechonnxmetrics
Unified speech evaluation metrics — no-reference MOS, intrusive (reference-based) signal metrics, ASR-based text metrics, and speaker similarity — behind one small API, running on numpy and onnxruntime only.
Why numpy + onnxruntime only
The entire runtime depends on just numpy, onnxruntime and huggingface_hub. There is
no torch in the runtime path. Neural MOS predictors (UTMOS, DNSMOS, NISQA, SIGMOS)
run as exported ONNX graphs, so the package installs small, imports fast, and runs the
same on CPU everywhere. The export extra pulls in torch/onnx, but only for offline
model conversion by maintainers — never at inference time.
Model weights download from public HuggingFace repos on first use and cache locally;
import speechonnxmetrics touches neither the network nor onnxruntime.
Install
Not yet on PyPI. Install from git:
pip install git+https://github.com/TigreGotico/speechonnxmetrics
Once published, pip install speechonnxmetrics will work too.
Extras (all optional):
| extra | pulls in | needed for |
|---|---|---|
audio |
soundfile |
non-WAV input (mp3/flac/ogg…). Base install decodes WAV via the stdlib. |
speaker |
speakeronnx |
speaker-embedding extraction for speaker_similarity |
asr |
onnx-asr |
running an ASR model to get hypotheses (WER/CER scoring itself needs nothing) |
vad |
vadonnx |
voice-activity gating |
export |
torch, onnx |
maintainer-only offline model conversion |
test |
pytest, pytest-cov, scipy |
running the test suite (scipy is a test-only oracle) |
pip install "speechonnxmetrics[audio,speaker]"
Quickstart
import speechonnxmetrics as s
# No-reference neural MOS (downloads UTMOS weights on first call, then caches):
print(s.score("test/fixtures/audio/source.wav", ["utmos"]))
# -> {'utmos': 4.4115...}
# Intrusive metrics need a clean reference (pure numpy, no download):
print(s.score("test/fixtures/audio/facodec_aria.wav",
["stoi", "mcd", "si_sdr"],
ref="test/fixtures/audio/source.wav"))
# -> {'stoi': 0.662..., 'mcd': 10.459..., 'si_sdr': -26.937...}
Dict-valued metrics flatten into the result: dnsmos becomes dnsmos.sig,
dnsmos.bak, dnsmos.ovrl; nisqa becomes nisqa.mos, nisqa.noi, … More in
examples/ — every script there runs against the bundled fixture audio.
Metrics
21 metrics live in one registry. score()/score_batch() dispatch the audio
metrics; the text metrics compare strings and are called directly from
speechonnxmetrics.asr. Enumerate everything at runtime with s.list_metrics() or
speechonnxmetrics list.
No-reference MOS (audio, needs model download)
| metric | range | ↑better | output | meaning |
|---|---|---|---|---|
utmos |
1–5 | yes | float | UTMOS22 naturalness MOS |
dnsmos |
1–5 | yes | sig, bak, ovrl |
DNSMOS P.835 speech / background / overall quality |
dnsmos_p808 |
1–5 | yes | float | DNSMOS P.808 crowdsourced-listening MOS |
sigmos |
1–5 | yes | 7 dims | SIGMOS P.804 quality (col,disc,loud,noise,reverb,sig,ovrl) |
nisqa |
1–5 | yes | mos,noi,dis,col,loud |
NISQA-v2 quality — NonCommercial weights |
Intrusive / reference-based (audio, pure numpy, needs ref=)
| metric | range | ↑better | meaning |
|---|---|---|---|
stoi |
0–1 | yes | short-time objective intelligibility |
estoi |
0–1 | yes | extended STOI |
si_sdr |
dB | yes | scale-invariant signal-to-distortion ratio |
sdr |
dB | yes | signal-to-distortion ratio |
snr |
dB | yes | signal-to-noise ratio |
mcd |
dB | no | mel-cepstral distortion |
log_f0_rmse |
— | no | log-F0 RMSE (pitch error) |
vuv_error |
0–1 | no | voiced/unvoiced decision error rate |
lsd |
dB | no | log-spectral distance |
msd |
dB | no | mel-spectral distortion |
mel_l1 |
— | no | L1 distance on log-mel spectrograms |
ASR-based text metrics (text, pure numpy, string in/out)
| metric | range | ↑better | meaning |
|---|---|---|---|
wer |
≥0 | no | word error rate |
cer |
0–1 | no | character error rate |
mer |
0–1 | no | match error rate |
wil |
0–1 | no | word information lost |
wip |
0–1 | yes | word information preserved |
Speaker similarity & verification
Not in the score() registry — call them from speechonnxmetrics.speaker:
speaker_similarity (cosine between speaker embeddings, needs the speaker extra),
plus pure-numpy eer, min_dcf and equal_error_threshold over score/label arrays.
Sample-rate handling is automatic: the base resamples input to each model's native rate
(UTMOS/DNSMOS 16 kHz, SIGMOS 48 kHz, STOI analysis at 10 kHz), and NISQA is
rate-adaptive and never resamples. See docs/metrics.md for the
per-metric detail and paper citations, and docs/models.md for the
ONNX models and their licences.
CLI
$ speechonnxmetrics --help
usage: speechonnxmetrics [-h] [--version] {score,list} ...
positional arguments:
{score,list}
score score one or more audio files
list list available metrics
$ speechonnxmetrics score --help
usage: speechonnxmetrics score [-h] [--ref REF] --metrics METRICS [--sr SR]
[--json]
audio [audio ...]
positional arguments:
audio degraded audio file(s) to score
options:
--ref REF reference audio file (required for intrusive metrics)
--metrics METRICS comma-separated metric names
--sr SR sample rate hint for raw input
--json emit JSON instead of a table
Real invocations:
$ speechonnxmetrics score test/fixtures/audio/facodec_aria.wav \
--ref test/fixtures/audio/source.wav --metrics stoi,mcd,si_sdr
audio mcd si_sdr stoi
test/fixtures/audio/facodec_aria.wav 10.459728433678961 -26.937894650414812 0.6620030195244008
$ speechonnxmetrics list
name kind intrusive requires_download
cer text True False
dnsmos audio False True
...
Full reference in docs/cli.md.
Licence
The package itself is Apache-2.0. Model weights carry their own licences:
| licence | metrics | commercial use |
|---|---|---|
| MIT | dnsmos, dnsmos_p808, sigmos, utmos |
permitted |
| CC BY-NC-SA 4.0 (NonCommercial) | nisqa |
forbidden |
nisqa is the one caveat: its weights are NonCommercial. Every other metric is
safe for commercial use. The package makes no choice for you — it exposes the metric
and states the terms; selecting it is your call. Full per-model breakdown in
docs/models.md.
Models are grouped in the HuggingFace collection speechonnxmetrics models under the
TigreGotico org.
Not provided (on purpose)
- PESQ — ITU-T P.862 licensing is incompatible with an open, pip-installable package, and neural MOS predictors supersede it. Use a dedicated PESQ package under your own licence review if you need it.
- UTMOSv2 — its published score is an ensemble over five folds × five random 3 s crops, so any single-fold single-crop export would be a different estimator, not an approximation of the published numbers.
Docs
docs/index.md— orientationdocs/metrics.md— every metric family in detaildocs/usage.md—scorevsscore_batch, custom metrics, cachingdocs/cli.md— CLI referencedocs/models.md— ONNX models, HF repos and licences
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file speechonnxmetrics-0.0.2a1.tar.gz.
File metadata
- Download URL: speechonnxmetrics-0.0.2a1.tar.gz
- Upload date:
- Size: 69.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b3d702352a53de76d33bfcff9cfee5d4e699a74e7a13401cab35309b93dbebe
|
|
| MD5 |
d356f110898aabf3d7b3c2cd4a1efabb
|
|
| BLAKE2b-256 |
5611701e0d90d79a6cd26ac52ed999636eab97cc7875be3dd3972fbf3164498c
|
File details
Details for the file speechonnxmetrics-0.0.2a1-py3-none-any.whl.
File metadata
- Download URL: speechonnxmetrics-0.0.2a1-py3-none-any.whl
- Upload date:
- Size: 57.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
52cb8b64b2498efa5002d4075f25107719d688af74af459ebf4007f2e8494869
|
|
| MD5 |
9aff3b0c316300ff26791e99e6cad250
|
|
| BLAKE2b-256 |
c3d49d1bca62cd3b3b1fdbe6f50e6e7a4aba54cbbc2547bcbe18309578d743a0
|