Forced Alignment Training

Training a recognizer can be done by computing forced alignment paths or loading such paths from label files and then accumulating training information in so-called accumulators. We've already used accumulators for loading the generic weights, and we've seen that computing an LDA matrix also works with data accumulation and an update step at the end.

On this page we will describe how simple a full training iteration is. The complete script is here. Start up Janus as you did in the previous steps (e.g. for writing labels). This time use the following Tcl procedure instead of the previously defined viterbi procedure:

proc forcedAlignment {utt {method viterbi}} {
  set uttInfo [db get $utt]
  makeArray arr $uttInfo
  hmm make $arr(text) -optWord SIL
  path $method hmm -eval $uttInfo
}
You can easily see that it does exactly the same, except you give it a second argument, in which case this second argument defines the alignment method. Janus offers two forced alignment methods (besides loading from file), namely viterbi and fwdBwd which stands for forward-backward. With this procedure we are ready for training an iteration with Viterbi alignment or forward-backward alignment (try both).

Before we can start the main training loop we have to create accumulators that can store the training data. Why do we have to do this explicitly? That's because such accumulators can become rather huge for large systems and we do not want to waste computer memory when not needed. So let's make accumulators for the codebooks and the distributions:

cbs createAccus
dss createAccus
Now comes the main training loop:
foreach utt [db] {
  puts  "$utt [forcedAlignment $utt]"
  sns accu path
}
This loop does Viterbi alignments, alternatively you could do:
foreach utt [db] {
  puts  "$utt [forcedAlignment $utt fwdBwd]"
  sns accu path
}
for computing forward-backward alignments. Once the training is finished, we can save the accumulated data in files:
cbs saveAccus codebookAccus
dss saveAccus distribAccus
But we can also update the actual weights and save these:
sns update
cbs save codebookWeights
dss save distribWeights