所以我尝试对文本进行一些语音识别,代码成功地将语音数据预测为文本输出。然后,我想使用混淆矩阵来评估以评估分类的准确性。但是矩阵的值为 0,并且 precision ,re-call,f1 分数的值也为 0。
这是代码:
if types == 1:
start_index = test_file.find('\')+1
end_index = test_file.rfind('\')+1
print('Predictions: ')
print()
print('Audio file:',test_file, start_index, end_index)
original_label = test_file[end_index:]
print('Original: {}'.format(original_label.split('/')[1]))
print('Predicted: {}'.format(predicted_label))
print()
y_test.append(original_label.split('/')[1])
predicted_labels.append(predicted_label)
else:
start_index = test_file.find('\') + 1
end_index = test_file.rfind('\')+1
original_label = test_file[end_index:]
y_test.append(original_label.split('/')[1])
predicted_labels.append(predicted_label)
cm = confusion_matrix(y_test, predicted_labels)
print(cm)
print(classification_report(y_test, predicted_labels))
这是混淆矩阵报告的结果:
我只想知道为什么,几乎所有的值都是 0。 谢谢!