--- id: torch-stoi version: "0.2.3" license: MIT license_treatment: permissive maintenance: dormant --- # torch-stoi — Computes Short Term Objective Intelligibility in PyTorch License: permissive · Maintenance: dormant · Downloads: 427.6K/mo ## What it is and what it does torch_stoi is a PyTorch implementation of the Short Term Objective Intelligibility (STOI) metric, designed specifically for use as a differentiable loss function in neural network training. It wraps the classical and extended STOI measures—metrics originally developed to predict speech intelligibility in noisy conditions—into a form that PyTorch can backpropagate through. The package depends on numpy, torch, pystoi, and torchaudio to compute the metric. The implementation is intentionally approximate rather than exact: it trades perfect fidelity to the original STOI algorithm for computational efficiency and differentiability in a training loop. The documentation explicitly warns that it is intended only as a loss function, not as a replacement for the original metric when exact reproducibility matters. This makes it suitable for training speech enhancement or denoising models where STOI-like objectives guide the network, but not for rigorous evaluation benchmarking. Use it for: - Train a speech denoising network using NegSTOILoss as the primary loss function to optimize for intelligibility rather than raw signal fidelity. - Combine NegSTOILoss with other losses in a multi-objective speech enhancement model to balance intelligibility and artifact reduction. - Validate speech enhancement models on STOI-like criteria during training without switching to a separate evaluation pipeline. - Experiment with speech quality metrics in PyTorch workflows where torchaudio and torch are already in use. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Computes Short Term Objective Intelligibility (STOI) as a PyTorch loss function for training speech enhancement models, wrapping the classical and extended STOI metrics in differentiable form. Yes, if you are training a PyTorch speech enhancement model and want STOI as a loss function. Install friction is low and the license is permissive. However, the dormant maintenance status (no releases for 683 days) and the documented approximation—not exact replication—of the original metric mean you should verify that the implementation's behavior matches your training requirements before committing to it in production. No known security vulnerabilities. ## Install pip install torch-stoi uv add torch-stoi poetry add torch-stoi ## Installing torch-stoi Before you install: Low friction—pure Python wheel with four runtime dependencies (numpy, torch, pystoi, torchaudio). Dormant maintenance status (last commit 2024-09-30, no releases for 683 days) means no active bug fixes or feature work, but the narrow scope and stable API reduce risk. License in practice: MIT license is permissive; you can use, modify, and distribute this package freely in commercial and open-source projects with minimal restrictions. Quickstart: pip install torch_stoi import torch from torch_stoi import NegSTOILoss sample_rate = 16000 loss_func = NegSTOILoss(sample_rate=sample_rate) noisy_speech = torch.randn(2, 16000) clean_speech = torch.randn(2, 16000) loss = loss_func(noisy_speech, clean_speech) Verify before relying: - Whether the PyTorch implementation's approximation error relative to the original STOI metric is acceptable for your specific training task (documentation notes results 'should be close enough' but exact quantitative bounds are not provided). - Minimum Python version and PyTorch version compatibility (requires_python is unspecified in the fact sheet). ## Package facts - License: MIT (permissive) - Python support: unspecified - Install friction: low - Maintenance: dormant - Downloads: 427.6K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags speech intelligibility loss pytorch, stoi loss function, speech enhancement training metric, audio quality loss pytorch, speech denoising objective, differentiable stoi metric, speech-processing, loss-function, audio-ml [View on SkillFed](https://skillfed.io/packages/torch-stoi) · [View on PyPI](https://pypi.org/project/torch-stoi/)