我一直在努力继续语音识别一个月,我找到了hmmlearn
包。我可以使用_model = hmm.GMMHMM(...)
和创建我的音素模型_model.fit(...)
。但是当我想使用 _model.score(_extracted_test_features) 测试样本时,我得到了这个错误:
.format(self.covariance_type)) ValueError: 'diag' mix covars must be non-negative
这是我的代码:
def Main():
# ---
_phoneme_files_dir = './database_info/phonemes/phoneme_files/'
_phoneme_dataset_dir = './database_info/phonemes/extracted_features/'
_phoneme_models_dir = './database_info/phonemes/models/'
_phoneme_test = '/home/ali/speech_recognition/database/database_english/timit/data/lisa/data/timit/raw/TIMIT/TEST/DR1/FAKS0/SA1.wav'
# ---
_phoneme_test_features = ExtractFeatures(_phoneme_test, 9640, 11240)
_phoneme_models, _phoneme_models_list_loaded = LoadModels(_phoneme_models_dir)
print("Getting models has successfully done")
# ---
_score_list = {}
for _model_label in _phoneme_models.keys():
_model = _phoneme_models[_model_label][0]
_score = _model.score(_phoneme_test_features)
_score_list[_model_label] = _score
_predict = max(_score_list, key=_score_list.get)
print("predict result phoneme is ", _phoneme_models_list_loaded[_predict])
有人知道这个错误吗?我找到了一些解决方案,但它们是几年前的,之后 hmmlearn 包得到了一些更新并修复了它们。