Skip to content

Commit

Permalink
Small suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
flyingleafe committed Nov 14, 2023
1 parent 0d72a4e commit 05a333c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pyannote/audio/pipelines/speaker_diarization.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,14 +533,15 @@ def apply(
# centroids: (num_speakers, dimension)

# number of detected clusters is the number of different speakers
num_different_speakers = int(np.max(hard_clusters) + 1)
num_different_speakers = np.max(hard_clusters) + 1

# detected number of speakers can still be out of bounds
# (specifically, lower than `min_speakers`), since there could be too few embeddings
# to make enough clusters with a given minimum cluster size.
if num_different_speakers < min_speakers or num_different_speakers > max_speakers:
warnings.warn(textwrap.dedent(
f"""The detected number of speakers ({num_different_speakers}) is outside
f"""
The detected number of speakers ({num_different_speakers}) is outside
the given bounds [{min_speakers}, {max_speakers}]. This can happen if the
given audio file is too short to contain {min_speakers} or more speakers.
Try to lower the desired minimal number of speakers.
Expand Down

0 comments on commit 05a333c

Please sign in to comment.