我正在制作一个通过 Surface EMG 信号进行手语识别的项目。现在,我想通过一个名为“single”的数组来训练一个 GMMHMM 模型。它的形状是 (2520, 840)。
for single in Norm_Feat_Vsplit:
# print(shape(single)) # (180, 840)
# print(type(single)) # <class 'numpy.ndarray'>
clf = hmm.GMMHMM(n_components=7, n_mix=4, covariance_type="diag", n_iter=10)
print('Training ' + str(index) + ' model... ')
clf1 = clf.fit(single)
print('Training finished!')
# Save model
print('Saving model...')
joblib.dump(clf1, "Hmm_model" + str(index) + ".m")
print('Saving finished!')
但是总会有一个ValueError如下:(有时它似乎能够成功训练第一个GMMHMM模型,但第二个会出错。)输出:
Training 1 model...
Traceback (most recent call last):
File "E:/桌面/手语识别资料/程序/Single_Hand/Single_Hand/One_Hand_Train(注释).py", line 378, in <module>
main()
File "E:/桌面/手语识别资料/程序/Single_Hand/Single_Hand/One_Hand_Train(注释).py", line 365, in main
clf1 = clf.fit(single)
File "D:\Anaconda3\lib\site-packages\hmmlearn\base.py", line 436, in fit
bwdlattice)
File "D:\Anaconda3\lib\site-packages\hmmlearn\hmm.py", line 607, in _accumulate_sufficient_statistics
raise ValueError
ValueError
Process finished with exit code 1
感谢您的帮助!