OnlineNnet2FeaturePipelineInfo Struct Reference

This class is responsible for storing configuration variables, objects and options for OnlineNnet2FeaturePipeline (including the actual LDA and CMVN-stats matrices, and the iVector extractor, which is a member of ivector_extractor_info. More...

#include <online-nnet2-feature-pipeline.h>

Collaboration diagram for OnlineNnet2FeaturePipelineInfo:

Public Member Functions

 OnlineNnet2FeaturePipelineInfo ()
 
 OnlineNnet2FeaturePipelineInfo (const OnlineNnet2FeaturePipelineConfig &config)
 
BaseFloat FrameShiftInSeconds () const
 
int32 IvectorDim ()
 

Public Attributes

std::string feature_type
 
MfccOptions mfcc_opts
 "mfcc" or "plp" or "fbank" More...
 
PlpOptions plp_opts
 options for MFCC computation, if feature_type == "mfcc" More...
 
FbankOptions fbank_opts
 Options for PLP computation, if feature_type == "plp". More...
 
bool add_pitch
 Options for filterbank computation, if feature_type == "fbank". More...
 
PitchExtractionOptions pitch_opts
 
ProcessPitchOptions pitch_process_opts
 Options for pitch extraction, if done. More...
 
bool use_cmvn
 Options for pitch post-processing. More...
 
OnlineCmvnOptions cmvn_opts
 
std::string global_cmvn_stats_rxfilename
 Options for online cmvn, read from config file. More...
 
bool use_ivectors
 Filename used for reading global cmvn stats in OnlineCmvn. More...
 
OnlineIvectorExtractionInfo ivector_extractor_info
 
OnlineSilenceWeightingConfig silence_weighting_config
 Config for weighting silence in iVector adaptation. More...
 

Private Member Functions

 KALDI_DISALLOW_COPY_AND_ASSIGN (OnlineNnet2FeaturePipelineInfo)
 

Detailed Description

This class is responsible for storing configuration variables, objects and options for OnlineNnet2FeaturePipeline (including the actual LDA and CMVN-stats matrices, and the iVector extractor, which is a member of ivector_extractor_info.

This class does not register options on the command line; instead, it is initialized from class OnlineNnet2FeaturePipelineConfig which reads the options from the command line. The reason for structuring it this way is to make it easier to configure from code as well as from the command line, as well as for easier multithreaded operation.

Definition at line 138 of file online-nnet2-feature-pipeline.h.

Constructor & Destructor Documentation

◆ OnlineNnet2FeaturePipelineInfo() [1/2]

Definition at line 139 of file online-nnet2-feature-pipeline.h.

139  :
140  feature_type("mfcc"), add_pitch(false), use_cmvn(false) { }
bool use_cmvn
Options for pitch post-processing.
bool add_pitch
Options for filterbank computation, if feature_type == "fbank".

◆ OnlineNnet2FeaturePipelineInfo() [2/2]

Definition at line 25 of file online-nnet2-feature-pipeline.cc.

References OnlineNnet2FeaturePipelineConfig::add_pitch, OnlineNnet2FeaturePipelineInfo::add_pitch, OnlineNnet2FeaturePipelineConfig::cmvn_config, OnlineNnet2FeaturePipelineInfo::cmvn_opts, OnlineNnet2FeaturePipelineConfig::fbank_config, OnlineNnet2FeaturePipelineInfo::fbank_opts, OnlineNnet2FeaturePipelineConfig::feature_type, OnlineNnet2FeaturePipelineInfo::feature_type, OnlineNnet2FeaturePipelineConfig::global_cmvn_stats_rxfilename, OnlineNnet2FeaturePipelineInfo::global_cmvn_stats_rxfilename, OnlineIvectorExtractionInfo::Init(), OnlineNnet2FeaturePipelineConfig::ivector_extraction_config, OnlineNnet2FeaturePipelineInfo::ivector_extractor_info, KALDI_ERR, KALDI_WARN, OnlineNnet2FeaturePipelineConfig::mfcc_config, OnlineNnet2FeaturePipelineInfo::mfcc_opts, OnlineNnet2FeaturePipelineConfig::online_pitch_config, OnlineNnet2FeaturePipelineInfo::pitch_opts, OnlineNnet2FeaturePipelineInfo::pitch_process_opts, OnlineNnet2FeaturePipelineConfig::plp_config, OnlineNnet2FeaturePipelineInfo::plp_opts, kaldi::ReadConfigFromFile(), kaldi::ReadConfigsFromFile(), OnlineNnet2FeaturePipelineInfo::use_cmvn, and OnlineNnet2FeaturePipelineInfo::use_ivectors.

26  :
27  silence_weighting_config(config.silence_weighting_config) {
28  if (config.feature_type == "mfcc" || config.feature_type == "plp" ||
29  config.feature_type == "fbank") {
30  feature_type = config.feature_type;
31  } else {
32  KALDI_ERR << "Invalid feature type: " << config.feature_type << ". "
33  << "Supported feature types: mfcc, plp, fbank.";
34  }
35 
36  if (config.mfcc_config != "") {
37  ReadConfigFromFile(config.mfcc_config, &mfcc_opts);
38  if (feature_type != "mfcc")
39  KALDI_WARN << "--mfcc-config option has no effect "
40  << "since feature type is set to " << feature_type << ".";
41  } // else use the defaults.
42 
43  if (config.plp_config != "") {
44  ReadConfigFromFile(config.plp_config, &plp_opts);
45  if (feature_type != "plp")
46  KALDI_WARN << "--plp-config option has no effect "
47  << "since feature type is set to " << feature_type << ".";
48  } // else use the defaults.
49 
50  if (config.fbank_config != "") {
51  ReadConfigFromFile(config.fbank_config, &fbank_opts);
52  if (feature_type != "fbank")
53  KALDI_WARN << "--fbank-config option has no effect "
54  << "since feature type is set to " << feature_type << ".";
55  } // else use the defaults.
56 
57  add_pitch = config.add_pitch;
58 
59  if (config.online_pitch_config != "") {
60  ReadConfigsFromFile(config.online_pitch_config,
61  &pitch_opts,
63  if (!add_pitch)
64  KALDI_WARN << "--online-pitch-config option has no effect "
65  << "since you did not supply --add-pitch option.";
66  } // else use the defaults.
67 
68  use_cmvn = (config.cmvn_config != "");
69  if (use_cmvn) {
70  ReadConfigFromFile(config.cmvn_config, &cmvn_opts);
71  global_cmvn_stats_rxfilename = config.global_cmvn_stats_rxfilename;
73  KALDI_ERR << "--global-cmvn-stats option is required "
74  << " when --cmvn-config is specified.";
75  }
76 
77  if (config.ivector_extraction_config != "") {
78  use_ivectors = true;
79  OnlineIvectorExtractionConfig ivector_extraction_opts;
80  ReadConfigFromFile(config.ivector_extraction_config,
81  &ivector_extraction_opts);
82  ivector_extractor_info.Init(ivector_extraction_opts);
83  } else {
84  use_ivectors = false;
85  }
86 }
bool use_cmvn
Options for pitch post-processing.
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...
bool add_pitch
Options for filterbank computation, if feature_type == "fbank".
FbankOptions fbank_opts
Options for PLP computation, if feature_type == "plp".
ProcessPitchOptions pitch_process_opts
Options for pitch extraction, if done.
PlpOptions plp_opts
options for MFCC computation, if feature_type == "mfcc"
#define KALDI_ERR
Definition: kaldi-error.h:147
#define KALDI_WARN
Definition: kaldi-error.h:150
void Init(const OnlineIvectorExtractionConfig &config)
std::string global_cmvn_stats_rxfilename
Options for online cmvn, read from config file.
void ReadConfigsFromFile(const std::string &conf, C1 *c1, C2 *c2)
This variant of the template ReadConfigFromFile is for if you need to read two config classes from th...
OnlineSilenceWeightingConfig silence_weighting_config
Config for weighting silence in iVector adaptation.
MfccOptions mfcc_opts
"mfcc" or "plp" or "fbank"
bool use_ivectors
Filename used for reading global cmvn stats in OnlineCmvn.

Member Function Documentation

◆ FrameShiftInSeconds()

BaseFloat FrameShiftInSeconds ( ) const

Definition at line 231 of file online-nnet2-feature-pipeline.cc.

References KALDI_ERR.

Referenced by main().

231  {
232  if (feature_type == "mfcc") {
233  return mfcc_opts.frame_opts.frame_shift_ms / 1000.0f;
234  } else if (feature_type == "fbank") {
235  return fbank_opts.frame_opts.frame_shift_ms / 1000.0f;
236  } else if (feature_type == "plp") {
237  return plp_opts.frame_opts.frame_shift_ms / 1000.0f;
238  } else {
239  KALDI_ERR << "Unknown feature type " << feature_type;
240  return 0.0;
241  }
242 }
FbankOptions fbank_opts
Options for PLP computation, if feature_type == "plp".
FrameExtractionOptions frame_opts
Definition: feature-fbank.h:42
PlpOptions plp_opts
options for MFCC computation, if feature_type == "mfcc"
FrameExtractionOptions frame_opts
Definition: feature-plp.h:43
FrameExtractionOptions frame_opts
Definition: feature-mfcc.h:39
#define KALDI_ERR
Definition: kaldi-error.h:147
MfccOptions mfcc_opts
"mfcc" or "plp" or "fbank"

◆ IvectorDim()

◆ KALDI_DISALLOW_COPY_AND_ASSIGN()

KALDI_DISALLOW_COPY_AND_ASSIGN ( OnlineNnet2FeaturePipelineInfo  )
private

Member Data Documentation

◆ add_pitch

bool add_pitch

Options for filterbank computation, if feature_type == "fbank".

Definition at line 155 of file online-nnet2-feature-pipeline.h.

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

◆ cmvn_opts

◆ fbank_opts

FbankOptions fbank_opts

Options for PLP computation, if feature_type == "plp".

Definition at line 152 of file online-nnet2-feature-pipeline.h.

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

◆ feature_type

◆ global_cmvn_stats_rxfilename

std::string global_cmvn_stats_rxfilename

◆ ivector_extractor_info

◆ mfcc_opts

◆ pitch_opts

◆ pitch_process_opts

◆ plp_opts

PlpOptions plp_opts

options for MFCC computation, if feature_type == "mfcc"

Definition at line 151 of file online-nnet2-feature-pipeline.h.

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

◆ silence_weighting_config

OnlineSilenceWeightingConfig silence_weighting_config

Config for weighting silence in iVector adaptation.

We declare this outside of ivector_extractor_info... it was just easier to set up the code that way; and also we think it's the kind of thing you might want to play with directly on the command line instead of inside sub-config-files.

Definition at line 177 of file online-nnet2-feature-pipeline.h.

Referenced by main().

◆ use_cmvn

bool use_cmvn

Options for pitch post-processing.

If the user specified –cmvn-config, we set 'use_cmvn' to true, and the OnlineCmvn is added to the feature preparation pipeline.

Definition at line 161 of file online-nnet2-feature-pipeline.h.

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

◆ use_ivectors

bool use_ivectors

Filename used for reading global cmvn stats in OnlineCmvn.

If the user specified –ivector-extraction-config, we assume we're using iVectors as an extra input to the neural net. Actually, we don't anticipate running this setup without iVectors.

Definition at line 169 of file online-nnet2-feature-pipeline.h.

Referenced by OnlineNnet2FeaturePipeline::GetAdaptationState(), OnlineNnet2FeaturePipeline::OnlineNnet2FeaturePipeline(), OnlineNnet2FeaturePipelineInfo::OnlineNnet2FeaturePipelineInfo(), and OnlineNnet2FeaturePipeline::SetAdaptationState().


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