CoolFace
Modelpublic

DroolingPanda/speaker-diarization-3.1

sourceHugging Facemitupdated 8mo agoView on Hugging Face
0likes23downloads
Model Card

Using this open-source model in production? Consider switching to pyannoteAI for better and faster options.

🎹 Speaker diarization 3.1

This pipeline is the same as `pyannote/speaker-diarization-3.0` except it removes the problematic use of onnxruntime. Both speaker segmentation and embedding now run in pure PyTorch. This should ease deployment and possibly speed up inference. It requires pyannote.audio version 3.1 or higher.

It ingests mono audio sampled at 16kHz and outputs speaker diarization as an `Annotation` instance:

  • stereo or multi-channel audio files are automatically downmixed to mono by averaging the channels.
  • audio files sampled at a different rate are resampled to 16kHz automatically upon loading.

Requirements

  1. 1.Install `pyannote.audio` 3.1 with pip install pyannote.audio
  2. 2.Accept `pyannote/segmentation-3.0` user conditions
  3. 3.Accept `pyannote/speaker-diarization-3.1` user conditions
  4. 4.Create access token at `hf.co/settings/tokens`.

Usage

python
# instantiate the pipeline
from pyannote.audio import Pipeline
pipeline = Pipeline.from_pretrained(
  "pyannote/speaker-diarization-3.1",
  use_auth_token="HUGGINGFACE_ACCESS_TOKEN_GOES_HERE")

# run the pipeline on an audio file
diarization = pipeline("audio.wav")

# dump the diarization output to disk using RTTM format
with open("audio.rttm", "w") as rttm:
    diarization.write_rttm(rttm)

Processing on GPU

pyannote.audio pipelines run on CPU by default. You can send them to GPU with the following lines:

python
import torch
pipeline.to(torch.device("cuda"))

Processing from memory

Pre-loading audio files in memory may result in faster processing:

python
waveform, sample_rate = torchaudio.load("audio.wav")
diarization = pipeline({"waveform": waveform, "sample_rate": sample_rate})

Monitoring progress

Hooks are available to monitor the progress of the pipeline:

python
from pyannote.audio.pipelines.utils.hook import ProgressHook
with ProgressHook() as hook:
    diarization = pipeline("audio.wav", hook=hook)

Controlling the number of speakers

In case the number of speakers is known in advance, one can use the num_speakers option:

python
diarization = pipeline("audio.wav", num_speakers=2)

One can also provide lower and/or upper bounds on the number of speakers using min_speakers and max_speakers options:

python
diarization = pipeline("audio.wav", min_speakers=2, max_speakers=5)

Benchmark

This pipeline has been benchmarked on a large collection of datasets.

Processing is fully automatic:

  • no manual voice activity detection (as is sometimes the case in the literature)
  • no manual number of speakers (though it is possible to provide it to the pipeline)
  • no fine-tuning of the internal models nor tuning of the pipeline hyper-parameters to each dataset

... with the least forgiving diarization error rate (DER) setup (named "Full" in this paper):

  • no forgiveness collar
  • evaluation of overlapped speech
Benchmark[DER%](. "Diarization error rate")[FA%](. "False alarm rate")[Miss%](. "Missed detection rate")[Conf%](. "Speaker confusion rate")Expected outputFile-level evaluation
AISHELL-412.23.84.44.0RTTMeval
AliMeeting (_channel 1_)24.44.410.010.0RTTMeval
AMI (_headset mix,_ _only_words_)18.83.69.55.7RTTMeval
AMI (_array1, channel 1,_ _only_words)_22.43.811.27.5RTTMeval
AVA-AVD50.010.815.723.4RTTMeval
DIHARD 3 (_Full_)21.76.28.17.3RTTMeval
MSDWild25.35.88.011.5RTTMeval
REPERE (_phase 2_)7.81.82.63.5RTTMeval
VoxConverse (_v0.3_)11.34.13.43.8RTTMeval

Citations

bibtex
@inproceedings{Plaquet23,
  author={Alexis Plaquet and Hervé Bredin},
  title={{Powerset multi-class cross entropy loss for neural speaker diarization}},
  year=2023,
  booktitle={Proc. INTERSPEECH 2023},
}
bibtex
@inproceedings{Bredin23,
  author={Hervé Bredin},
  title={{pyannote.audio 2.1 speaker diarization pipeline: principle, benchmark, and recipe}},
  year=2023,
  booktitle={Proc. INTERSPEECH 2023},
}