Lattice scaling

258 views
Skip to first unread message

Mael Primet

unread,
Aug 30, 2017, 4:14:33 AM8/30/17
to kaldi-help
The code from <https://github.com/kaldi-asr/kaldi/blob/d82bbd7a23053ab8e9b2e1f67b714e94fd48fc55/src/online2bin/online2-wav-nnet3-latgen-faster.cc> does not seem to scale the lattice returned by `GetLattice` before getting the best result

```

decoder.GetLattice(end_of_utterance, &clat);
// Get result
CompactLatticeShortestPath(clat, &best_path_clat);
ConvertLattice(best_path_clat, &best_path_lat);
GetLinearSymbolSequence(best_path_lat, &alignment, &words, &weight);
```


but I saw some other code which would apply the acoustic scale and language model scale before getting the best result like this:

```
decoder_->GetLattice(end_of_utterance, clat);
if (acoustic_scale_ != 0) {
    ScaleLattice(fst::AcousticLatticeScale(1.0 / acoustic_scale_), clat);
}

if (lm_scale_ != 0) {
    fst::ScaleLattice(fst::LatticeScale(lm_scale_, 1.0), &clat);
}
// Get result
CompactLatticeShortestPath(clat, &best_path_clat);
ConvertLattice(best_path_clat, &best_path_lat);
GetLinearSymbolSequence(best_path_lat, &alignment, &words, &weight);
```

what is the correct way to do the decoding?

Daniel Povey

unread,
Aug 30, 2017, 3:41:55 PM8/30/17
to kaldi-help
The lattice that comes from the decoder has the acoustic scale applied, and that's how you want to get the best path.  Traditionally we reverse the acoustic scale before writing out the lattice.
The second piece of code that you showed was wrong.  Most likely it was third-party code.


--
Go to http://kaldi-asr.org/forums.html find out how to join
---
You received this message because you are subscribed to the Google Groups "kaldi-help" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kaldi-help+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages