OnlineIvectorExtractionInfo Struct Reference

This struct contains various things that are needed (as const references) by class OnlineIvectorExtractor. More...

#include <online-ivector-feature.h>

Collaboration diagram for OnlineIvectorExtractionInfo:

Public Member Functions

 OnlineIvectorExtractionInfo (const OnlineIvectorExtractionConfig &config)
 
void Init (const OnlineIvectorExtractionConfig &config)
 
int32 ExpectedFeatureDim () const
 
 OnlineIvectorExtractionInfo ()
 
void Check () const
 

Public Attributes

Matrix< BaseFloatlda_mat
 
Matrix< double > global_cmvn_stats
 
OnlineCmvnOptions cmvn_opts
 
bool online_cmvn_iextractor
 
OnlineSpliceOptions splice_opts
 
DiagGmm diag_ubm
 
IvectorExtractor extractor
 
int32 ivector_period
 
int32 num_gselect
 
BaseFloat min_post
 
BaseFloat posterior_scale
 
BaseFloat max_count
 
int32 num_cg_iters
 
bool use_most_recent_ivector
 
bool greedy_ivector_extractor
 
BaseFloat max_remembered_frames
 

Private Member Functions

 KALDI_DISALLOW_COPY_AND_ASSIGN (OnlineIvectorExtractionInfo)
 

Detailed Description

This struct contains various things that are needed (as const references) by class OnlineIvectorExtractor.

Definition at line 168 of file online-ivector-feature.h.

Constructor & Destructor Documentation

◆ OnlineIvectorExtractionInfo() [1/2]

Definition at line 24 of file online-ivector-feature.cc.

References OnlineIvectorExtractionInfo::Init().

25  {
26  Init(config);
27 }
void Init(const OnlineIvectorExtractionConfig &config)

◆ OnlineIvectorExtractionInfo() [2/2]

Member Function Documentation

◆ Check()

void Check ( ) const

Definition at line 80 of file online-ivector-feature.cc.

References OnlineIvectorExtractionInfo::diag_ubm, DiagGmm::Dim(), OnlineIvectorExtractionInfo::extractor, IvectorExtractor::FeatDim(), OnlineIvectorExtractionInfo::global_cmvn_stats, OnlineIvectorExtractionInfo::ivector_period, KALDI_ASSERT, OnlineIvectorExtractionInfo::lda_mat, OnlineSpliceOptions::left_context, OnlineIvectorExtractionInfo::max_remembered_frames, OnlineIvectorExtractionInfo::min_post, OnlineIvectorExtractionInfo::num_gselect, MatrixBase< Real >::NumCols(), MatrixBase< Real >::NumRows(), OnlineIvectorExtractionInfo::posterior_scale, OnlineSpliceOptions::right_context, and OnlineIvectorExtractionInfo::splice_opts.

Referenced by OnlineIvectorExtractionInfo::Init(), and OnlineIvectorFeature::OnlineIvectorFeature().

80  {
82  int32 base_feat_dim = global_cmvn_stats.NumCols() - 1,
84  spliced_input_dim = base_feat_dim * num_splice;
85 
86  KALDI_ASSERT(lda_mat.NumCols() == spliced_input_dim ||
87  lda_mat.NumCols() == spliced_input_dim + 1);
92  KALDI_ASSERT(min_post < 0.5);
93  // posterior scale more than one does not really make sense.
96 }
int32 Dim() const
Returns the dimensionality of the Gaussian mean vectors.
Definition: diag-gmm.h:74
MatrixIndexT NumCols() const
Returns number of columns (or zero for empty matrix).
Definition: kaldi-matrix.h:67
kaldi::int32 int32
#define KALDI_ASSERT(cond)
Definition: kaldi-error.h:185
MatrixIndexT NumRows() const
Returns number of rows (or zero for empty matrix).
Definition: kaldi-matrix.h:64

◆ ExpectedFeatureDim()

int32 ExpectedFeatureDim ( ) const

Definition at line 70 of file online-ivector-feature.cc.

References KALDI_WARN, OnlineIvectorExtractionInfo::lda_mat, OnlineSpliceOptions::left_context, MatrixBase< Real >::NumCols(), OnlineSpliceOptions::right_context, and OnlineIvectorExtractionInfo::splice_opts.

Referenced by main().

70  {
72  full_dim = lda_mat.NumCols();
73  if (!(full_dim % num_splice == 0 || full_dim % num_splice == 1)){
74  KALDI_WARN << "Error getting expected feature dimension: full-dim = "
75  << full_dim << ", num-splice = " << num_splice;
76  }
77  return full_dim / num_splice;
78 }
MatrixIndexT NumCols() const
Returns number of columns (or zero for empty matrix).
Definition: kaldi-matrix.h:67
kaldi::int32 int32
#define KALDI_WARN
Definition: kaldi-error.h:150

◆ Init()

void Init ( const OnlineIvectorExtractionConfig config)

Definition at line 29 of file online-ivector-feature.cc.

References OnlineIvectorExtractionInfo::Check(), OnlineIvectorExtractionConfig::cmvn_config_rxfilename, OnlineIvectorExtractionInfo::cmvn_opts, OnlineIvectorExtractionInfo::diag_ubm, OnlineIvectorExtractionConfig::diag_ubm_rxfilename, OnlineIvectorExtractionInfo::extractor, OnlineIvectorExtractionInfo::global_cmvn_stats, OnlineIvectorExtractionConfig::global_cmvn_stats_rxfilename, OnlineIvectorExtractionConfig::greedy_ivector_extractor, OnlineIvectorExtractionInfo::greedy_ivector_extractor, OnlineIvectorExtractionConfig::ivector_extractor_rxfilename, OnlineIvectorExtractionConfig::ivector_period, OnlineIvectorExtractionInfo::ivector_period, KALDI_ERR, KALDI_WARN, OnlineIvectorExtractionInfo::lda_mat, OnlineIvectorExtractionConfig::lda_mat_rxfilename, OnlineIvectorExtractionConfig::max_count, OnlineIvectorExtractionInfo::max_count, OnlineIvectorExtractionConfig::max_remembered_frames, OnlineIvectorExtractionInfo::max_remembered_frames, OnlineIvectorExtractionConfig::min_post, OnlineIvectorExtractionInfo::min_post, OnlineIvectorExtractionConfig::num_cg_iters, OnlineIvectorExtractionInfo::num_cg_iters, OnlineIvectorExtractionConfig::num_gselect, OnlineIvectorExtractionInfo::num_gselect, OnlineIvectorExtractionConfig::online_cmvn_iextractor, OnlineIvectorExtractionInfo::online_cmvn_iextractor, OnlineIvectorExtractionConfig::posterior_scale, OnlineIvectorExtractionInfo::posterior_scale, kaldi::ReadConfigFromFile(), kaldi::ReadKaldiObject(), OnlineIvectorExtractionConfig::splice_config_rxfilename, OnlineIvectorExtractionInfo::splice_opts, OnlineIvectorExtractionConfig::use_most_recent_ivector, and OnlineIvectorExtractionInfo::use_most_recent_ivector.

Referenced by OnlineIvectorExtractionInfo::OnlineIvectorExtractionInfo(), and OnlineNnet2FeaturePipelineInfo::OnlineNnet2FeaturePipelineInfo().

30  {
31  online_cmvn_iextractor = config.online_cmvn_iextractor;
32  ivector_period = config.ivector_period;
33  num_gselect = config.num_gselect;
34  min_post = config.min_post;
35  posterior_scale = config.posterior_scale;
36  max_count = config.max_count;
37  num_cg_iters = config.num_cg_iters;
38  use_most_recent_ivector = config.use_most_recent_ivector;
39  greedy_ivector_extractor = config.greedy_ivector_extractor;
41  KALDI_WARN << "--greedy-ivector-extractor=true implies "
42  << "--use-most-recent-ivector=true";
44  }
45  max_remembered_frames = config.max_remembered_frames;
46 
47  std::string note = "(note: this may be needed "
48  "in the file supplied to --ivector-extractor-config)";
49  if (config.lda_mat_rxfilename == "")
50  KALDI_ERR << "--lda-matrix option must be set " << note;
51  ReadKaldiObject(config.lda_mat_rxfilename, &lda_mat);
52  if (config.global_cmvn_stats_rxfilename == "")
53  KALDI_ERR << "--global-cmvn-stats option must be set " << note;
54  ReadKaldiObject(config.global_cmvn_stats_rxfilename, &global_cmvn_stats);
55  if (config.cmvn_config_rxfilename == "")
56  KALDI_ERR << "--cmvn-config option must be set " << note;
57  ReadConfigFromFile(config.cmvn_config_rxfilename, &cmvn_opts);
58  if (config.splice_config_rxfilename == "")
59  KALDI_ERR << "--splice-config option must be set " << note;
60  ReadConfigFromFile(config.splice_config_rxfilename, &splice_opts);
61  if (config.diag_ubm_rxfilename == "")
62  KALDI_ERR << "--diag-ubm option must be set " << note;
63  ReadKaldiObject(config.diag_ubm_rxfilename, &diag_ubm);
64  if (config.ivector_extractor_rxfilename == "")
65  KALDI_ERR << "--ivector-extractor option must be set " << note;
66  ReadKaldiObject(config.ivector_extractor_rxfilename, &extractor);
67  this->Check();
68 }
void ReadConfigFromFile(const std::string &config_filename, C *c)
This template is provided for convenience in reading config classes from files; this is not the stand...
void ReadKaldiObject(const std::string &filename, Matrix< float > *m)
Definition: kaldi-io.cc:832
#define KALDI_ERR
Definition: kaldi-error.h:147
#define KALDI_WARN
Definition: kaldi-error.h:150

◆ KALDI_DISALLOW_COPY_AND_ASSIGN()

KALDI_DISALLOW_COPY_AND_ASSIGN ( OnlineIvectorExtractionInfo  )
private

Member Data Documentation

◆ cmvn_opts

◆ diag_ubm

◆ extractor

◆ global_cmvn_stats

◆ greedy_ivector_extractor

bool greedy_ivector_extractor

Definition at line 190 of file online-ivector-feature.h.

Referenced by OnlineIvectorExtractionInfo::Init(), and main().

◆ ivector_period

int32 ivector_period

◆ lda_mat

◆ max_count

BaseFloat max_count

Definition at line 187 of file online-ivector-feature.h.

Referenced by OnlineIvectorExtractionInfo::Init().

◆ max_remembered_frames

BaseFloat max_remembered_frames

◆ min_post

◆ num_cg_iters

int32 num_cg_iters

Definition at line 188 of file online-ivector-feature.h.

Referenced by OnlineIvectorExtractionInfo::Init().

◆ num_gselect

◆ online_cmvn_iextractor

bool online_cmvn_iextractor

Definition at line 174 of file online-ivector-feature.h.

Referenced by OnlineIvectorExtractionInfo::Init().

◆ posterior_scale

◆ splice_opts

◆ use_most_recent_ivector

bool use_most_recent_ivector

Definition at line 189 of file online-ivector-feature.h.

Referenced by OnlineIvectorExtractionInfo::Init(), and main().


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