Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alignment of separation output and diarization #1775

Merged
merged 5 commits into from
Oct 23, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions pyannote/audio/pipelines/speech_separation.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class SpeechSeparation(SpeakerDiarizationMixin, Pipeline):

def __init__(
self,
segmentation: PipelineModel = None,
segmentation: PipelineModel = "pyannote/separation-ami-1.0",
segmentation_step: float = 0.1,
embedding: PipelineModel = "speechbrain/spkrec-ecapa-voxceleb@5c0be3875fda05e81f3c004ed8c7c06be308de1e",
embedding_exclude_overlap: bool = False,
Expand Down Expand Up @@ -698,6 +698,15 @@ def apply(
# strings and integers when reference is available and some hypothesis
# speakers are not present in the reference)

# re-order sources so that they match
# the order given by diarization.labels()
inverse_mapping = {label: index for index, label in mapping.items()}
original_sliding_window = sources.sliding_window
data = sources.data[
:, [inverse_mapping[label] for label in diarization.labels()]
]
sources = SlidingWindowFeature(data, original_sliding_window)

Lebourdais marked this conversation as resolved.
Show resolved Hide resolved
if not return_embeddings:
return diarization, sources

Expand All @@ -717,7 +726,6 @@ def apply(

# re-order centroids so that they match
# the order given by diarization.labels()
inverse_mapping = {label: index for index, label in mapping.items()}
centroids = centroids[
[inverse_mapping[label] for label in diarization.labels()]
]
Expand Down