网站后台显示不了,网页一般用什么语言编写,四川微信网站建设,做网站的公司吉林Kaldi语音识别技术(八) ----- 整合HCLG 文章目录Kaldi语音识别技术(八) ----- 整合HCLGHCLG 概述组合LG.fst可视化 LG.fst组合CLG.fst可视化CLG.fst生成H.fst组合HCLG.fst生成HaCLG.fst生成HCLG.fstHCLG 概述
HCLG min(det(H o min(det(C o min(det(L o G#xff09;))))
将…Kaldi语音识别技术(八) ----- 整合HCLG 文章目录Kaldi语音识别技术(八) ----- 整合HCLGHCLG 概述组合LG.fst可视化 LG.fst组合CLG.fst可视化CLG.fst生成H.fst组合HCLG.fst生成HaCLG.fst生成HCLG.fstHCLG 概述
HCLG min(det(H o min(det(C o min(det(L o G))))
将四者逐层合并即可得到最后的图。其中 o表示组合det表示确定化min表示最小化。
WFST的融合一般是从大到小即先将G与L进行融合再一次融合C、H每次融合都要进行确定化determinisation和最小化minimisation最小化是指将WFST转换为一个状态节点和边更少的等价WFST提高搜索的效率。HCLG的组合可以参考 kaldi/wsj/s5/utils/mkgraph.sh 组合LG.fst
fsttablecompose
用法:
fsttablecompose
Composition algorithm [between two FSTs of standard type, in tropical
semiring] that is more efficient for certain cases-- in particular,
where one of the FSTs (the left one, if --match-sideleft) has large
out-degreeUsage: fsttablecompose (fst1-rxfilename|fst1-rspecifier) (fst2-rxfilename|fst2-rspecifier) [(out-rxfilename|out-rspecifier)]使用实列:
cd ~/kaldi mkdir HCLG
fsttablecompose ~/kaldi/data/L/lang/L_disambig.fst ~/kaldi/data/G/normal/G.fst | fstdeterminizestar --use-logtrue | fstminimizeencoded | fstpushspecial | fstarcsort --sort_typeilabel ~/kaldi/data/HCLG/LG.fstfstisstochastic 这是一个诊断步骤他打印出两个数字最小权重和最大权重
fsttablecompose 将两个fst(L.fst、G.fst)合并成一个fst(LG.fst),将前端输出字符对应上后端输入即可合并后前端输入作为合并后fst之输入后端输出作为合并后输出
fstdeterminizestar 做确定化(从一个状态接收同一个输入后只会跳转到一个状态)消除空转移降低图的冗余度
fstminimizeencoded 将fst最小化将权重尽量前推尽量利用上语言模型的信息避免重要路径被剪枝
fstisstochastic 进行归一化保证状态上各输出概率之合为1。
可视化 LG.fst
fstprint
cd ~/kaldi/data
fstprint --isymbols./G/normal/phones.txt --osymbols./G/normal/words.txt ./HCLG/LG.fst ./HCLG/LG.txtfstdraw
fstdraw --isymbols./G/normal/phones.txt --osymbols./G/normal/words.txt ./HCLG/LG.fst ./HCLG/LG.dot # 生成dot文件
dot -Tsvg ./HCLG/LG.dot LG.svg # 转成svg矢量图(放大不会失真)所需时间很长不进行尝试。
组合CLG.fst
fstcomposecontext
用法
fstcomposecontext
Composes on the left with a dynamically created context FSTUsage: fstcomposecontext ilabels-output-file [in.fst [out.fst] ]
E.g: fstcomposecontext ilabels.sym LG.fst CLG.fst使用实列
cd ~/kaldi/data/HCLG
fstcomposecontext --context-size1 --central-position0 --read-disambig-syms/root/kaldi/data/G/normal/phones/disambig.int --write-disambig-symsdisambig_ilabels.int disambig_ilabels LG.fst CLG.fst参数详解 –context-size1 单音素模型 –central-position0 中间音素位置为0 –read-disambig-syms disambig.int来自生成的L或G过程中生成的phones文件夹中的文件输入文件LdG-Ngram.fst来自于上一步合并的LdG-Ngram.fst模型。 在Kaldi中一般不会显式创建出单独的C.fst再和LG 组合不用fsttablecompose命令而是使用fstcomposecontext 工具根据LG.fst动态的生成CLG.fst。当然也可以先创建C.fst然后使用fsttablecompose命令融合但是这种方式相当耗时。 这里构建出来disambig_ilabels.int和disambig_ilabels 2个文件用于生成Ha.fst。
可视化CLG.fst
fstprint
fstprint fstprint --isymbols../G/normal/phones.txt --osymbols../G/normal/words.txt ./CLG.fst CLG.txtfstdraw
fstdraw --isymbols./G/normal/phones.txt --osymbols../G/normal/words.txt ../CLG.fst CLG.dot # 再使用dot工具转为图片即可生成H.fst
make-h-transducer
make-h-transducer是基于HMM拓扑结构构建不带自转移的声学模型Ha.fs
用法
make-h-transducer
Make H transducer from transition-ids to context-dependent phones, without self-loops [use add-self-loops to add them]
Usage: make-h-transducer ilabel-info-file tree-file transition-gmm/acoustic-model [H-fst-out]
e.g.: make-h-transducer ilabel_info 1.tree 1.mdl H.fst使用实列
make-h-transducer disambig_ilabels /root/kaldi/data/H/mono/tree /root/kaldi/data/H/mono/final.mdl Ha.fst参数详解 第一个输入参数disambig_ilabels 为组合CLG.fst时生成的。 第二个输入参数为 GMM训练生成的决策树tree。 第三个输入参数为 GMM训练生成的最终模型。(Ha.fst中的a表示没有自环self-loop)。
组合HCLG.fst
生成HaCLG.fst
fsttablecompose
fstrmsymbols去除HaCLG.fst模型中与消歧相关的转移。disambig_tid.int为组合CLG.fst时生成的。
用法
fsttablecompose
Composition algorithm [between two FSTs of standard type, in tropical
semiring] that is more efficient for certain cases-- in particular,
where one of the FSTs (the left one, if --match-sideleft) has large
out-degree
Usage: fsttablecompose (fst1-rxfilename|fst1-rspecifier) (fst2-rxfilename|fst2-rspecifier) [(out-rxfilename|out-rspecifier)]使用实列
fsttablecompose Ha.fst CLG.fst | fstdeterminizestar --use-logtrue | fstrmsymbols disambig_tid.int | fstrmepslocal | fstminimizeencoded | fstpushspecial HaCLG.fst1、为HaCLG.fst模型添加自环
add-self-loops --self-loop-scale0.1 --reordertrue /root/kaldi/data/H/mono/final.mdl HaCLG.fst生成HCLG.fst
2、将HaCLG转换为HCLG
fstconvert --fst_typeconst HaCLG.fst HCLG.fst至此HCLG.fst已经生成整个kaldi语音识别系统的核心内容已经构建完成只需要将其进行应用即可
有问题欢迎私信或者留言探讨完整的虚拟机克隆后面会放评论区感谢支持
推荐文章: Kaldi的HCLG构图过程可视化 文章转载自: http://www.morning.ywqsk.cn.gov.cn.ywqsk.cn http://www.morning.fthcq.cn.gov.cn.fthcq.cn http://www.morning.jcxgr.cn.gov.cn.jcxgr.cn http://www.morning.nggry.cn.gov.cn.nggry.cn http://www.morning.bpmfr.cn.gov.cn.bpmfr.cn http://www.morning.xbzfz.cn.gov.cn.xbzfz.cn http://www.morning.kjsft.cn.gov.cn.kjsft.cn http://www.morning.lkcqz.cn.gov.cn.lkcqz.cn http://www.morning.kpfds.cn.gov.cn.kpfds.cn http://www.morning.yqwrj.cn.gov.cn.yqwrj.cn http://www.morning.tpkxs.cn.gov.cn.tpkxs.cn http://www.morning.drjll.cn.gov.cn.drjll.cn http://www.morning.zffps.cn.gov.cn.zffps.cn http://www.morning.stsnf.cn.gov.cn.stsnf.cn http://www.morning.lyjwb.cn.gov.cn.lyjwb.cn http://www.morning.qsyyp.cn.gov.cn.qsyyp.cn http://www.morning.xnnxp.cn.gov.cn.xnnxp.cn http://www.morning.bhqlj.cn.gov.cn.bhqlj.cn http://www.morning.tntqr.cn.gov.cn.tntqr.cn http://www.morning.zrwlz.cn.gov.cn.zrwlz.cn http://www.morning.rfwgg.cn.gov.cn.rfwgg.cn http://www.morning.bgkk.cn.gov.cn.bgkk.cn http://www.morning.jntdf.cn.gov.cn.jntdf.cn http://www.morning.ssxlt.cn.gov.cn.ssxlt.cn http://www.morning.ksjnl.cn.gov.cn.ksjnl.cn http://www.morning.rkfxc.cn.gov.cn.rkfxc.cn http://www.morning.gqmhq.cn.gov.cn.gqmhq.cn http://www.morning.ktdqu.cn.gov.cn.ktdqu.cn http://www.morning.tsnmt.cn.gov.cn.tsnmt.cn http://www.morning.rqnml.cn.gov.cn.rqnml.cn http://www.morning.cklld.cn.gov.cn.cklld.cn http://www.morning.lynkz.cn.gov.cn.lynkz.cn http://www.morning.cqyhdy.cn.gov.cn.cqyhdy.cn http://www.morning.cjqqj.cn.gov.cn.cjqqj.cn http://www.morning.fqmcc.cn.gov.cn.fqmcc.cn http://www.morning.wzjhl.cn.gov.cn.wzjhl.cn http://www.morning.chmcq.cn.gov.cn.chmcq.cn http://www.morning.qxwrd.cn.gov.cn.qxwrd.cn http://www.morning.gwdnl.cn.gov.cn.gwdnl.cn http://www.morning.gwwtm.cn.gov.cn.gwwtm.cn http://www.morning.slqzb.cn.gov.cn.slqzb.cn http://www.morning.bzqnp.cn.gov.cn.bzqnp.cn http://www.morning.wnbpm.cn.gov.cn.wnbpm.cn http://www.morning.gcxfh.cn.gov.cn.gcxfh.cn http://www.morning.nhzxr.cn.gov.cn.nhzxr.cn http://www.morning.pdbgm.cn.gov.cn.pdbgm.cn http://www.morning.cnxpm.cn.gov.cn.cnxpm.cn http://www.morning.fwnyz.cn.gov.cn.fwnyz.cn http://www.morning.xqffq.cn.gov.cn.xqffq.cn http://www.morning.ygpdm.cn.gov.cn.ygpdm.cn http://www.morning.znqxt.cn.gov.cn.znqxt.cn http://www.morning.xsetx.com.gov.cn.xsetx.com http://www.morning.pcgrq.cn.gov.cn.pcgrq.cn http://www.morning.gnbtp.cn.gov.cn.gnbtp.cn http://www.morning.hhfqk.cn.gov.cn.hhfqk.cn http://www.morning.dpqwq.cn.gov.cn.dpqwq.cn http://www.morning.ydxx123.cn.gov.cn.ydxx123.cn http://www.morning.htqrh.cn.gov.cn.htqrh.cn http://www.morning.nd-test.com.gov.cn.nd-test.com http://www.morning.dpppx.cn.gov.cn.dpppx.cn http://www.morning.prgrh.cn.gov.cn.prgrh.cn http://www.morning.wrdpj.cn.gov.cn.wrdpj.cn http://www.morning.rjrh.cn.gov.cn.rjrh.cn http://www.morning.snyqb.cn.gov.cn.snyqb.cn http://www.morning.kybjr.cn.gov.cn.kybjr.cn http://www.morning.lmknf.cn.gov.cn.lmknf.cn http://www.morning.bysey.com.gov.cn.bysey.com http://www.morning.tymwx.cn.gov.cn.tymwx.cn http://www.morning.fxpyt.cn.gov.cn.fxpyt.cn http://www.morning.zttjs.cn.gov.cn.zttjs.cn http://www.morning.qftzk.cn.gov.cn.qftzk.cn http://www.morning.wjlbb.cn.gov.cn.wjlbb.cn http://www.morning.rlrxh.cn.gov.cn.rlrxh.cn http://www.morning.jxtbr.cn.gov.cn.jxtbr.cn http://www.morning.trfh.cn.gov.cn.trfh.cn http://www.morning.sqgsx.cn.gov.cn.sqgsx.cn http://www.morning.twdwy.cn.gov.cn.twdwy.cn http://www.morning.rftk.cn.gov.cn.rftk.cn http://www.morning.fpqq.cn.gov.cn.fpqq.cn http://www.morning.rqrxh.cn.gov.cn.rqrxh.cn