Skip to content

Commit

Permalink
Ensure that clusterless speakers go last in the binary diarization
Browse files Browse the repository at this point in the history
  • Loading branch information
flyingleafe committed Nov 14, 2023
1 parent 05a333c commit d1be399
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pyannote/audio/pipelines/utils/diarization.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,9 @@ def to_diarization(
activations = activations.crop(extent, return_data=False)
count = count.crop(extent, return_data=False)

sorted_speakers = np.argsort(-activations, axis=-1)
# stable sort ensures that all the padding speakers (ones which were added
# above via padding based on `count` maximum) are always in the end of speaker list.
sorted_speakers = np.argsort(-activations, axis=-1, kind="stable")
binary = np.zeros_like(activations.data)

for t, ((_, c), speakers) in enumerate(zip(count, sorted_speakers)):
Expand Down

0 comments on commit d1be399

Please sign in to comment.