OnlineGmmDecodingModels Class Reference

This class is used to read, store and give access to the models used for 3 phases of decoding (first-pass with online-CMN features; the ML models used for estimating transforms; and the discriminatively trained models). More...

#include <online-gmm-decoding.h>

Collaboration diagram for OnlineGmmDecodingModels:

Public Member Functions

 OnlineGmmDecodingModels (const OnlineGmmDecodingConfig &config)
 
const TransitionModelGetTransitionModel () const
 
const AmDiagGmmGetOnlineAlignmentModel () const
 
const AmDiagGmmGetModel () const
 
const AmDiagGmmGetFinalModel () const
 
const BasisFmllrEstimateGetFmllrBasis () const
 

Private Attributes

TransitionModel tmodel_
 
AmDiagGmm online_alignment_model_
 
AmDiagGmm model_
 
AmDiagGmm rescore_model_
 
BasisFmllrEstimate fmllr_basis_
 

Detailed Description

This class is used to read, store and give access to the models used for 3 phases of decoding (first-pass with online-CMN features; the ML models used for estimating transforms; and the discriminatively trained models).

It takes care of the logic whereby if, say, the last model isn't given we default to the second model, and so on, and it interpretes the filenames from the config object. It is passed as a const reference to other objects in this header.

Definition at line 166 of file online-gmm-decoding.h.

Constructor & Destructor Documentation

◆ OnlineGmmDecodingModels()

Definition at line 346 of file online-gmm-decoding.cc.

References TransitionModel::Compatible(), OnlineGmmDecodingConfig::fmllr_basis_rxfilename, KALDI_ASSERT, KALDI_ERR, OnlineGmmDecodingConfig::model_rxfilename, OnlineGmmDecodingConfig::online_alimdl_rxfilename, TransitionModel::Read(), OnlineGmmDecodingConfig::rescore_model_rxfilename, and Input::Stream().

347  {
348  KALDI_ASSERT(!config.model_rxfilename.empty() &&
349  "You must supply the --model option");
350 
351  {
352  bool binary;
353  Input ki(config.model_rxfilename, &binary);
354  tmodel_.Read(ki.Stream(), binary);
355  model_.Read(ki.Stream(), binary);
356  }
357 
358  if (!config.online_alimdl_rxfilename.empty()) {
359  bool binary;
360  Input ki(config.online_alimdl_rxfilename, &binary);
361  TransitionModel tmodel;
362  tmodel.Read(ki.Stream(), binary);
363  if (!tmodel.Compatible(tmodel_))
364  KALDI_ERR << "Incompatible models given to the --model and "
365  << "--online-alignment-model options";
366  online_alignment_model_.Read(ki.Stream(), binary);
367  }
368 
369  if (!config.rescore_model_rxfilename.empty()) {
370  bool binary;
371  Input ki(config.rescore_model_rxfilename, &binary);
372  TransitionModel tmodel;
373  tmodel.Read(ki.Stream(), binary);
374  if (!tmodel.Compatible(tmodel_))
375  KALDI_ERR << "Incompatible models given to the --model and "
376  << "--final-model options";
377  rescore_model_.Read(ki.Stream(), binary);
378  }
379 
380  if (!config.fmllr_basis_rxfilename.empty()) {
381  // We could just as easily use ReadKaldiObject() here.
382  bool binary;
383  Input ki(config.fmllr_basis_rxfilename, &binary);
384  fmllr_basis_.Read(ki.Stream(), binary);
385  }
386 }
void Read(std::istream &in_stream, bool binary)
void Read(std::istream &is, bool binary)
#define KALDI_ERR
Definition: kaldi-error.h:147
#define KALDI_ASSERT(cond)
Definition: kaldi-error.h:185
void Read(std::istream &in_stream, bool binary)
Definition: am-diag-gmm.cc:147

Member Function Documentation

◆ GetFinalModel()

const AmDiagGmm & GetFinalModel ( ) const

Definition at line 404 of file online-gmm-decoding.cc.

Referenced by SingleUtteranceGmmDecoder::GetLattice(), and SingleUtteranceGmmDecoder::RescoringIsNeeded().

404  {
405  if (rescore_model_.NumPdfs() != 0)
406  return rescore_model_;
407  else
408  return model_;
409 }
int32 NumPdfs() const
Definition: am-diag-gmm.h:82

◆ GetFmllrBasis()

const BasisFmllrEstimate & GetFmllrBasis ( ) const

Definition at line 411 of file online-gmm-decoding.cc.

Referenced by SingleUtteranceGmmDecoder::EstimateFmllr().

411  {
412  return fmllr_basis_;
413 }

◆ GetModel()

◆ GetOnlineAlignmentModel()

const AmDiagGmm & GetOnlineAlignmentModel ( ) const

◆ GetTransitionModel()

Member Data Documentation

◆ fmllr_basis_

BasisFmllrEstimate fmllr_basis_
private

Definition at line 195 of file online-gmm-decoding.h.

◆ model_

AmDiagGmm model_
private

Definition at line 189 of file online-gmm-decoding.h.

◆ online_alignment_model_

AmDiagGmm online_alignment_model_
private

Definition at line 187 of file online-gmm-decoding.h.

◆ rescore_model_

AmDiagGmm rescore_model_
private

Definition at line 192 of file online-gmm-decoding.h.

◆ tmodel_

TransitionModel tmodel_
private

Definition at line 184 of file online-gmm-decoding.h.


The documentation for this class was generated from the following files: