我正在使用高斯混合模型进行说话人识别。我使用此代码来预测每个语音剪辑的扬声器。
for path in file_paths:
path = path.strip()
print (path)
sr,audio = read(source + path)
vector = extract_features(audio,sr)
#print(vector)
log_likelihood = np.zeros(len(models))
#print(len(log_likelihood))
for i in range(len(models)):
gmm1 = models[i] #checking with each model one by one
#print(gmm1)
scores = np.array(gmm1.score(vector))
#print(scores)
#print(len(scores))
log_likelihood[i] = scores.sum()
print(log_likelihood)
winner = np.argmax(log_likelihood)
#print(winner)
print ("\tdetected as - ", speakers[winner])
它给了我这样的输出:
[ 311.79769716 0. 0. 0. 0. ]
[ 311.79769716 -5692.56559902 0. 0. 0. ]
[ 311.79769716 -5692.56559902 -6170.21460788 0. 0. ]
[ 311.79769716 -5692.56559902 -6170.21460788 -6736.73192695 0. ]
[ 311.79769716 -5692.56559902 -6170.21460788 -6736.73192695 -6753.00196447]
detected as - bart
这里的分数函数给了我每个说话者的对数概率。现在我想确定阈值,因为我需要将这些对数概率值转换为简单的概率值(在 0 到 1 之间)。我怎样才能做到这一点?我正在使用python软件。