Skip to content

Commit

Permalink
fix: fix #1567
Browse files Browse the repository at this point in the history
  • Loading branch information
hbredin committed Dec 1, 2023
1 parent 28b5531 commit e80b542
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pyannote/audio/pipelines/clustering.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,13 @@ def filter_embeddings(
speaker_idx : (num_embeddings, ) array
"""

chunk_idx, speaker_idx = np.where(~np.any(np.isnan(embeddings), axis=2))
# whether speaker is active
active = np.sum(segmentations.data, axis=1) > 0
# whether speaker embedding extraction went fine
valid = ~np.any(np.isnan(embeddings), axis=2)

# indices of embeddings that are both active and valid
chunk_idx, speaker_idx = np.where(active * valid)

# sample max_num_embeddings embeddings
num_embeddings = len(chunk_idx)
Expand Down Expand Up @@ -240,6 +246,7 @@ def __call__(
)

num_embeddings, _ = train_embeddings.shape

num_clusters, min_clusters, max_clusters = self.set_num_clusters(
num_embeddings,
num_clusters=num_clusters,
Expand Down

0 comments on commit e80b542

Please sign in to comment.