Skip to content

Kaldi DNN Simple Notes

Ben Chen edited this page Aug 4, 2017 · 3 revisions

Kaldi Deep Nerual Net

References

How to Train a Deep Neural Net Acoustic Model with Kaldi

Intro

Labeled frames(phoneme-to-audio alignements) generated by a GMM-HMM system are needed for DNN trainning.

Directories needed

  1. data/train (generated by local/prepare_data.sh)
  2. data/lang (generated by local/prepare_lang.sh)
  3. exp/tri*_ali (generated by align_si.sh)
  4. mfcc (generated by make_mfcc.sh)

Train

steps/nnet2/train*.sh

4 obligatory arguments are:

  1. data/train (the trainning data)
  2. data/lang (the language dir)
  3. exp/tri*_ali (the alignments from the previous GMM-HMM model)
  4. $exp_dir (for DNN model to output to)

Decode

steps/nnet2/decode*.sh

6 args:

  1. exp/tri\*/graph (the decoding graph from the GMM-HMM)
  2. data/test (the test data)
  3. $exp_dir/final.mdl (trained DNN acoustic model
  4. UNK (the unknown phone)
  5. SIL (the silence phone
  6. $exp_dir/decode (new dir to save decoding info in (lattices, etc))

utils/best_wer.sh Get the score from the results.

The train*.sh

Parse Options, Check files, Prepare dirs

  1. Args for the DNN
  2. Some files in $data_dir, $lang_dir, $ali_dir
  3. tree (copied from the GMM-HMM), num_jobs, log

Estimating the LDA Feature Transform

get_lda.sh

This transformation matrix will be applied to our spliced features before we take them in as input to our DNN.

What's LDA?

线性判别分析(Linear Discriminant Analysis)(一) - JerryLead - 博客园

Format the Training data

get_egs.sh

Splits the training data into training and validation. The validation is used fo diagnostics during the training iterations.

Initialize the Neural Net

  1. Define the dimensions and architecture of our neural net in nnet.config:

    1. SpliceComponent defines the size of the window of feature-frame-splicing to perform.
    2. FixedAffineComponent is our LDA-like transform created by get_lda_simple.sh.
    3. AffineComponent is the standard Wx+b affine transform found in neural nets. This first AffineComponent represents the weights and biases between the input layer and the first hidden layer.
    4. TanhComponent is the standard tanh nonlinearity.
    5. AffineComponent is the standard Wx+b affine transform found in neural nets. This second AffineComponent represents the weights and biases between the hidden layer and the output layer.
    6. SoftmaxComponent is the final nonlinearity that produces properly normalized probabilities at the output.
  2. Define the structure of the hidden layers in hidden.config

  3. Initialize the first neural net, aka 0.mdl with nnet-am-init, args are:

    1. $ali_dir/tree
    2. $lang_dir/topo
    3. "nnet-init $exp_dir/nnet.config -|"
    4. $exp_dir/0.mdl (output)
  4. Train the transitions of the HMMs in the DNN-HMM acoustic model with nnet-train-transitions, args are:

    1. $exp_dir/0.mdl
    2. "ark:gunzip -c $ali_dir/ali.*.gz|"
    3. $exp_dir/0.mdl
  5. The Main Training Loop, which will update params via backprop. (nnet-train-parallel)

Clone this wiki locally