语音识别工具箱HTK 识别yes 和no

版权声明:转载请注明出处 https://blog.csdn.net/qq_26769591/article/details/82810340

前言:

这篇文章是在安装好htk的基础之上进一步做的 参看我的上一篇博文

https://blog.csdn.net/qq_26769591/article/details/82802095

这个htk真心麻烦 真的要学一学怎么写一个脚本,自动执行这么多的步骤了

识别效果真的不咋地吧

我发现自己写的blog 被覆盖了 很生气 !csdn 的导出功能不能导出图片这是什么鬼 !没有备份真是一个巨大的错误!

参考文献:http://www.cnblogs.com/mingzhao810/archive/2012/08/03/2617674.html

官方的文档:《htk 基础指南》

特别鸣谢:孙大佬

1.修改 htk_htklib_nt.mkf 文件

2.录制声音

HSLab  yes.sig  (没有就创建 有就打开该文件)

在这里插入图片描述

3.给声音做标记

(删除比较麻烦 但是能删除 删除的时候 它不会消失)
在这里插入图片描述

4.将所有的*.lab文件放入到laber_dir文件夹中

在这里插入图片描述

5.特征提取

编写 analysis.conf

编写 targetlist.txt

运行

  Hcopy -A -D -C  analysis.conf -S targetlist.txt

6.建立HMM模型

(下面的三个文件 是A矩阵 就是传递概率的参数)

编写 hmm_yes

编写 hmm_no

编写 hmm_sil

7.对模型初始化

编写 trainlist.txt

新建 hmm0文件夹

输入命令

   HInit -A -D -T 1 -S trainlist.txt -M hmm0 -H hmm_yes -l yes -L label_dir yes 回车
    HInit -A -D -T 1 -S trainlist.txt -M hmm0 -H hmm_no  -l no  -L label_dir no  回车
    HInit -A -D -T 1 -S trainlist.txt -M hmm0 -H hmm_sil   -l sil   -L label_dir sil 回车

8.训练文件

新建文件夹 hmm0flat

输入命令:

Hcompv -A -D -T 1 -S trainlist.txt -M hmm0flat -H hmm_yes -f 0.01 yes

新建 hmm1 hmm2 hmm3

输入命令

HRest -A -D -T 1 -S trainlist.txt -M hmm1 -H hmm0\hmm_yes -H vFloors -l sil -L label_dir sil
HRest -A -D -T 1 -S trainlist.txt -M hmm2 -H hmm0\hmm_yes -H vFloors -l sil -L label_dir sil
HRest -A -D -T 1 -S trainlist.txt -M hmm3 -H hmm0\hmm_yes -H vFloors -l sil -L label_dir sil

HRest -A -D -T 1 -S trainlist.txt -M hmm1 -H hmm0\hmm_no -H vFloors -l sil -L label_dir sil
HRest -A -D -T 1 -S trainlist.txt -M hmm2 -H hmm0\hmm_no -H vFloors -l sil -L label_dir sil
HRest -A -D -T 1 -S trainlist.txt -M hmm3 -H hmm0\hmm_no -H vFloors -l sil -L label_dir sil

HRest -A -D -T 1 -S trainlist.txt -M hmm1 -H hmm0\hmm_sil -H vFloors -l sil -L label_dir sil
HRest -A -D -T 1 -S trainlist.txt -M hmm2 -H hmm0\hmm_sil -H vFloors -l sil -L label_dir sil
HRest -A -D -T 1 -S trainlist.txt -M hmm3 -H hmm0\hmm_sil -H vFloors -l sil -L label_dir sil

复制文件

运行后在hmm0flat文件夹中有vFloors文件。复制到当前文件夹中。

9. 建立词典文件

编写 gram.txt

编写 dict.txt

输入命令

HParse -A -D -T 1 gram.txt net.slf
HSGen -A -D -n 10 -s net.slf dict.txt

10.识别

编写文件 hmmlist.txt

编写文件 reco.mlf

输入命令:

HVite -A -D -T 1 -H hmm3\hmm_yes -H hmm3\hmm_no -H hmm3\hmm_sil -I reco.mlf -w net.slf dict.txt hmmlist.txt yes_00.mfcc 

记事本打开reco.mlf,便可看到识别结果

11.交互式识别

编写文件:derectin.conf

输入命令:

HVite -A -D -T 1 -C directin.conf -g -H hmm3\hmm_yes -H hmm3\hmm_no -H hmm3\hmm_sil -w net.slf dict.txt hmmlist.txt

在这里插入图片描述

遇到的问题:

1 麦克风

其实就是声音太小

2 字典文件格式的问题

删掉空格 加回车

3 文件中的注释不能要

把参考教程中的中文注释都要删掉

4 命令中的文件名字有误

参考教程中有一处命名错误,有一处命令中的文件名错误

5. 要新建一些空文件

它不会自动创建文件

6.命令中的参数 需要换一下(体现在下面的命令中)

HRest -A -D -T 1 -S trainlist.txt -M hmm1 -H hmm0\hmm_yes -H vFloors -l sil -L label_dir sil
HRest -A -D -T 1 -S trainlist.txt -M hmm2 -H hmm0\hmm_yes -H vFloors -l sil -L label_dir sil
HRest -A -D -T 1 -S trainlist.txt -M hmm3 -H hmm0\hmm_yes -H vFloors -l sil -L label_dir sil

HRest -A -D -T 1 -S trainlist.txt -M hmm1 -H hmm0\hmm_no -H vFloors -l sil -L label_dir sil
HRest -A -D -T 1 -S trainlist.txt -M hmm2 -H hmm0\hmm_no -H vFloors -l sil -L label_dir sil
HRest -A -D -T 1 -S trainlist.txt -M hmm3 -H hmm0\hmm_no -H vFloors -l sil -L label_dir sil

HRest -A -D -T 1 -S trainlist.txt -M hmm1 -H hmm0\hmm_sil -H vFloors -l sil -L label_dir sil
HRest -A -D -T 1 -S trainlist.txt -M hmm2 -H hmm0\hmm_sil -H vFloors -l sil -L label_dir sil
HRest -A -D -T 1 -S trainlist.txt -M hmm3 -H hmm0\hmm_sil -H vFloors -l sil -L label_dir sil

后记:所有的文件下载:

https://github.com/sunny73/MATLAB_VOICE/tree/db9d4e8abc27c30b57b0eaa567e7cac6c8471849

猜你喜欢

转载自blog.csdn.net/qq_26769591/article/details/82810340