Replies: 4 comments 7 replies
|
Not out of the box, no. One straightforward solution would be to concatenate A more involved solution would be to
|
|
Just take a 10 seconds clip of James and add it to the audio2 file. Now perform SD on the file and you will get James as Speaker 0. |
|
I am working on this for some research. I'm creating an API to manage transcriptions of groups who have multiple meetings. It will be used in an educational setting for a supervisor to manage the meetings of groups completing a project. The audio for each meeting is uploaded and I am using whisper and pyannote to transcribe the meetings. Here's my gist for my basic solution |
|
Right — not out of the box, because speaker labels are only consistent within a single diarization run. To carry a speaker's identity across files you have to match on embeddings, not on the labels. Concrete recipe: from pyannote.audio import Pipeline, Inference, Model
from pyannote.core import Segment
import numpy as np
from sklearn.cluster import AgglomerativeClustering
dia = Pipeline.from_pretrained("pyannote/speaker-diarization-3.1", use_auth_token=TOKEN)
emb = Inference(Model.from_pretrained("pyannote/embedding", use_auth_token=TOKEN),
window="whole")
voiceprints, index = [], [] # one averaged embedding per (file, local speaker)
for path in ["audio1.wav", "audio2.wav"]:
diar = dia(path)
for spk in diar.labels():
vecs = [emb.crop(path, seg) for seg in diar.label_timeline(spk)
if seg.duration > 0.5]
if vecs:
voiceprints.append(np.mean(vecs, axis=0))
index.append((path, spk))
# cluster the voiceprints across ALL files -> stable global IDs
labels = AgglomerativeClustering(n_clusters=None, distance_threshold=0.7,
metric="cosine", linkage="average").fit_predict(voiceprints)
global_id = {index[i]: f"SPEAKER_{labels[i]:02d}" for i in range(len(index))}Now |
Uh oh!
There was an error while loading. Please reload this page.
Is there any way to identify the same speaker in a different file? How about adding a label?
For example, let's say I have James who is speaking in
audio1.wavandaudio2.wav. Pyannote identifies him asSPEAKER_07inaudio1.wav. Is there any way to force pyannote to recocnize him asSPEAKER_07when I run it onaudio2.wav?All reactions