【发布时间】:2020-11-16 16:09:07
【问题描述】:
目前我正在 python 上使用 pyannote 进行嵌入的扬声器 Diarization。 我通过命令安装pynnote:
!pip install -q https://github.com/pyannote/pyannote-audio/tarball/develop
我的嵌入函数如下所示:
import torch
import librosa
from pyannote.core import Segment
def embeddings_(audio_path,resegmented,range):
model_emb = torch.hub.load('pyannote/pyannote-audio', 'emb')
embedding = model_emb({'audio': audio_path})
for window, emb in embedding:
assert isinstance(window, Segment)
assert isinstance(emb, np.ndarray)
y, sr = librosa.load(audio_path)
myDict={}
myDict['audio'] = audio_path
myDict['duration'] = len(y)/sr
data=[]
for i in resegmented:
excerpt = Segment(start=i[0], end=i[0]+range)
emb = model_emb.crop(myDict,excerpt)
data.append(emb.T)
data= np.asarray(data)
return data.reshape(len(data),512)
当我调用函数时:
embeddings = embeddings_(audiofile,resegmented,2)
我收到了这个错误:
FileNotFoundError: "pyannote.database" relies on a YAML configuration file but could not find any. Here are the locations that were looked for: /home/subhash/Untitled Folder/Inpycgam/database.yml, /home/subhash/.pyannote/database.yml.
源代码:https://github.com/muskang48/Speaker-Diarization/blob/master/sp_diarization.ipynb
【问题讨论】:
标签: python machine-learning deep-learning voice-recognition pyaudio