asteroid.dsp.consistency module¶
-
asteroid.dsp.consistency.
mixture_consistency
(mixture: <sphinx.ext.autodoc.importer._MockObject object at 0x7f85d61896d0>, est_sources: <sphinx.ext.autodoc.importer._MockObject object at 0x7f85d6189510>, src_weights: Optional[<sphinx.ext.autodoc.importer._MockObject object at 0x7f85d6189810>] = None, dim: int = 1) → <sphinx.ext.autodoc.importer._MockObject object at 0x7f85d6189b10>[source]¶ Applies mixture consistency to a tensor of estimated sources.
Parameters: - mixture (torch.Tensor) – Mixture waveform or TF representation.
- est_sources (torch.Tensor) – Estimated sources waveforms or TF representations.
- src_weights (torch.Tensor) – Consistency weight for each source. Shape needs to be broadcastable to est_source. We make sure that the weights sum up to 1 along dim dim. If src_weights is None, compute them based on relative power.
- dim (int) – Axis which contains the sources in est_sources.
- Returns
- torch.Tensor with same shape as est_sources, after applying mixture consistency.
- Examples
>>> # Works on waveforms >>> mix = torch.randn(10, 16000) >>> est_sources = torch.randn(10, 2, 16000) >>> new_est_sources = mixture_consistency(mix, est_sources, dim=1) >>> # Also works on spectrograms >>> mix = torch.randn(10, 514, 400) >>> est_sources = torch.randn(10, 2, 514, 400) >>> new_est_sources = mixture_consistency(mix, est_sources, dim=1)
Note
This method can be used only in ‘complete’ separation tasks, otherwise the residual error will contain unwanted sources. For example, this won’t work with the task “sep_noisy” from WHAM.
- References
- Scott Wisdom et al. “Differentiable consistency constraints for improved deep speech enhancement”, ICASSP 2019.