Lightning-AI / Lightning-AI/torchmetrics
Support masks in audio metrics
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.5k
- Forks
- 526
- Avg merge
- 6d 11h
- Merged PRs (30d)
- 5
Description
## 🚀 Feature
It would be great if [ScaleInvariantSignalDistortionRatio](https://torchmetrics.readthedocs.io/en/stable/audio/scale_invariant_signal_distortion_ratio.html#scale-invariant-signal-to-distortion-ratio-si-sdr) and [ScaleInvariantSignalNoiseRatio](https://torchmetrics.readthedocs.io/en/stable/audio/scale_invariant_signal_noise_ratio.html) allowed an extra argument `mask` when computing a metric on a batch of audio frames which have been zero-padded to fit the batch. Allowing to pass a mask would only compute the metric on valid audio frames across the batch.
### Alternatives
In the TorchAudio [tutorial](https://github.com/pytorch/audio/blob/main/examples/source_separation/utils/metrics.py) they have manually computed the metrics to account for this.
Would be call if torchmetrics did this.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the implementations of ScaleInvariantSignalDistortionRatio and ScaleInvariantSignalNoiseRatio, then compare the manual masked calculations in the linked TorchAudio tutorial. Done means both metrics accept a mask and exclude zero-padded audio frames when computing batch results, with behavior covered by appropriate tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100