Kaldi HCLG 深入理解

1. 相关部分包含的主要任务


1.1 WFST Key Concepts

  1. determinization
  2. minimization
  3. composition
  4. equivalent
  5. epsilon-free
  6. functional
  7. on-demand algorithm
  8. weight-pushing
  9. epsilon removal

1.2 HMM Key Concepts

  1. Markov Chain
  2. Hidden Markov Model
  3. Forward-backward algorithm
  4. Viterbi algorithm
  5. E-M for mixture of Gaussians
2. HCLG

L.fst: The Phonetic Dictionary FST



maps monophone sequences to words.

The file L.fst is the Finite State Transducer form of the lexicon with phone symbols on the input and word symbols on the output.

L_disambig.fst:The Phonetic Dictionary with Disambiguation Symbols FST

A lexicon with disambiguation symbols


G.fst:The Language Model FST

FSA grammar (can be built from an n-gram grammar).


C.fst:The Context FST

C maps triphone sequences to monophones.

Expands the phones into context-dependent phones.


H.fst:The HMM FST

H maps multiple HMM states (a.k.a. transition-ids in Kaldi-speak) to context-dependent triphones.

Expands out the HMMs. On the right are the context-dependent phones and on the left are the pdf-ids. 


HCLG.fst: final graph




总结一下:


构图过程 G -> L -> C -> H

          G: 作为 acceptor (输入 symbol 与输出相同),用于对grammar 或者 language model 进行编码
          L:Lexicon, 其输出 symbol 是 words, 输入 symbol 是 phones
          C:context-dependency 其输出 symbol 是 phones, 其输入 symbol 为表示context-dependency phones

              如: vector<int32> ctx_window = { 12, 15, 21 };
                      含义:id = 15 的 phone 为 中心 phone, left phone id = 12, right phone id = 21

          H: 包括HMM definitions,其输出 symbol 为 context-dependency phones, 其输入 symbol 为 transitions-ids(即 对 pdf-id 和 其它信息编码后的 id) 
 
            asl=="add-self-loops” 
          rds=="remove-disambiguation-symbols”, 
          and H' is H without the self-loops:

          HCLG = asl(min(rds(det(H' o min(det(C o min(det(L o G))))))))

转自:http://blog.youkuaiyun.com/dearwind153/article/details/70053704

### KaldiHCLG 的重构或优化方法 在 Kaldi 语音识别框架中,HCLG 是一个非常重要的加权有限状态转换器(WFST),它综合了发音词典(H)、上下文依赖建模(C)、语言模型(L 和 G)。以下是关于如何进行 HCLG 构造过程中的重构或优化的技术细节: #### 1. **修改语言模型** 通过调整语言模型权重和回退比例来改进解码性能。这可以通过重新编译 `G.fst` 来实现,具体操作可以参考文档说明[^1]。此外,在构建过程中还可以引入更复杂的神经网络语言模型替代传统的 N-gram 模型。 ```bash # 使用 arpa2fst 工具生成新的 G.fst 文件 arpa2fst --disambig-symbol=#0 data/lm/words.txt data/lm/lm.arpa data/lang/G.fst ``` 此命令展示了如何基于 ARPA 格式的语言模型文件创建一个新的 WFST 表示形式 \(G\) [^4]。 #### 2. **组合 CLG.fst 并简化结构** 为了减少内存占用并加速解码速度,通常会对中间阶段产生的 FST 进行确定化、最小化以及剪枝处理。这些步骤有助于降低复杂度而不显著影响准确性[^2]。 ```python import fst def compose_clg_fsts(cl_path, lg_path): cl = fst.read_openfsm(cl_path) lg = fst.read_openfsm(lg_path) composed = cl.compose(lg).determinize().minimize() return composed.write('data/clg_composed.fst') ``` 上述 Python 函数演示了一个简单的流程用于合成 C 和 LG,并对其进行必要的预处理操作[^3]。 #### 3. **动态加载与在线解码支持** 对于某些应用场景而言,可能并不希望一次性将整个 HCLG 加载到内存当中。因此,Kaldi 提供了一种机制允许我们在运行时按需读取部分数据流完成实时计算任务。 #### 4. **错误排查及环境配置注意事项** 当遇到诸如缺少特定版本库文件等问题时,请确保开发环境中安装有兼容的标准模板库(STL)[^5] 。同时也要注意不同平台间可能存在差异化的依赖关系管理方式。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值