🚀 說話人分割
說話人分割依賴於 pyannote.audio 2.0
,請參考安裝說明。
🚀 快速開始
from pyannote.audio import Pipeline
pipeline = Pipeline.from_pretrained("pyannote/speaker-diarization@2022.07")
diarization = pipeline("audio.wav")
with open("audio.rttm", "w") as rttm:
diarization.write_rttm(rttm)
💻 使用示例
基礎用法
from pyannote.audio import Pipeline
pipeline = Pipeline.from_pretrained("pyannote/speaker-diarization@2022.07")
diarization = pipeline("audio.wav")
with open("audio.rttm", "w") as rttm:
diarization.write_rttm(rttm)
高級用法
如果事先知道說話人的數量,可以使用 num_speakers
選項:
diarization = pipeline("audio.wav", num_speakers=2)
也可以使用 min_speakers
和 max_speakers
選項提供說話人數量的下限和/或上限:
diarization = pipeline("audio.wav", min_speakers=2, max_speakers=5)
如果你喜歡嘗試新事物,可以嘗試調整各種管道超參數。例如,可以通過增加 segmentation_onset
閾值的值來使用更激進的語音活動檢測:
hparams = pipeline.parameters(instantiated=True)
hparams["segmentation_onset"] += 0.1
pipeline.instantiate(hparams)
📚 詳細文檔
基準測試
即時因子
使用一塊英偉達 Tesla V100 SXM2 GPU(用於神經推理部分)和一塊英特爾 Cascade Lake 6248 CPU(用於聚類部分)時,即時因子約為 5%。
換句話說,處理一小時的對話大約需要 3 分鐘。
準確性
此管道在不斷增加的數據集上進行了基準測試。
處理過程完全自動化:
- 無需手動進行語音活動檢測(文獻中有時會這樣做)
- 無需手動指定說話人數量(儘管可以將其提供給管道)
- 無需對內部模型進行微調,也無需針對每個數據集調整管道超參數
... 採用最嚴格的分割錯誤率(DER)設置(在本文中稱為 "Full"):
支持
如需商業諮詢和科學諮詢,請聯繫我。
如需技術問題和錯誤報告,請查看 pyannote.audio 的 GitHub 倉庫。
引用
@inproceedings{Bredin2021,
Title = {{End-to-end speaker segmentation for overlap-aware resegmentation}},
Author = {{Bredin}, Herv{\'e} and {Laurent}, Antoine},
Booktitle = {Proc. Interspeech 2021},
Address = {Brno, Czech Republic},
Month = {August},
Year = {2021},
}
@inproceedings{Bredin2020,
Title = {{pyannote.audio: neural building blocks for speaker diarization}},
Author = {{Bredin}, Herv{\'e} and {Yin}, Ruiqing and {Coria}, Juan Manuel and {Gelly}, Gregory and {Korshunov}, Pavel and {Lavechin}, Marvin and {Fustes}, Diego and {Titeux}, Hadrien and {Bouaziz}, Wassim and {Gill}, Marie-Philippe},
Booktitle = {ICASSP 2020, IEEE International Conference on Acoustics, Speech, and Signal Processing},
Address = {Barcelona, Spain},
Month = {May},
Year = {2020},
}
📄 許可證
本項目採用 MIT 許可證。