OnlineFeaturePipelineConfig Struct Reference

This configuration class is responsible for storing the configuration options for OnlineFeaturePipeline, but it does not set them. More...

#include <online-feature-pipeline.h>

Collaboration diagram for OnlineFeaturePipelineConfig:

Public Member Functions

 OnlineFeaturePipelineConfig ()
 
 OnlineFeaturePipelineConfig (const OnlineFeaturePipelineCommandLineConfig &cmdline_config)
 
BaseFloat FrameShiftInSeconds () const
 

Public Attributes

std::string feature_type
 
MfccOptions mfcc_opts
 
PlpOptions plp_opts
 
FbankOptions fbank_opts
 
bool add_pitch
 
PitchExtractionOptions pitch_opts
 
ProcessPitchOptions pitch_process_opts
 
OnlineCmvnOptions cmvn_opts
 
bool add_deltas
 
DeltaFeaturesOptions delta_opts
 
bool splice_feats
 
OnlineSpliceOptions splice_opts
 
std::string lda_rxfilename
 
std::string global_cmvn_stats_rxfilename
 

Detailed Description

This configuration class is responsible for storing the configuration options for OnlineFeaturePipeline, but it does not set them.

To do that you should use OnlineFeaturePipelineCommandLineConfig, which can read in the configuration from config files on disk. The reason for structuring it this way with two config files, is to make it easier to configure from code as well as from the command line.

Definition at line 112 of file online-feature-pipeline.h.

Constructor & Destructor Documentation

◆ OnlineFeaturePipelineConfig() [1/2]

◆ OnlineFeaturePipelineConfig() [2/2]

Definition at line 26 of file online-feature-pipeline.cc.

References OnlineFeaturePipelineCommandLineConfig::add_deltas, OnlineFeaturePipelineConfig::add_deltas, OnlineFeaturePipelineCommandLineConfig::add_pitch, OnlineFeaturePipelineConfig::add_pitch, OnlineFeaturePipelineCommandLineConfig::cmvn_config, OnlineFeaturePipelineConfig::cmvn_opts, OnlineFeaturePipelineCommandLineConfig::delta_config, OnlineFeaturePipelineConfig::delta_opts, OnlineFeaturePipelineCommandLineConfig::fbank_config, OnlineFeaturePipelineConfig::fbank_opts, OnlineFeaturePipelineCommandLineConfig::feature_type, OnlineFeaturePipelineConfig::feature_type, OnlineFeaturePipelineCommandLineConfig::global_cmvn_stats_rxfilename, OnlineFeaturePipelineConfig::global_cmvn_stats_rxfilename, KALDI_ERR, KALDI_WARN, OnlineFeaturePipelineCommandLineConfig::lda_rxfilename, OnlineFeaturePipelineConfig::lda_rxfilename, OnlineFeaturePipelineCommandLineConfig::mfcc_config, OnlineFeaturePipelineConfig::mfcc_opts, OnlineFeaturePipelineCommandLineConfig::pitch_config, OnlineFeaturePipelineConfig::pitch_opts, OnlineFeaturePipelineCommandLineConfig::pitch_process_config, OnlineFeaturePipelineConfig::pitch_process_opts, OnlineFeaturePipelineCommandLineConfig::plp_config, OnlineFeaturePipelineConfig::plp_opts, kaldi::ReadConfigFromFile(), OnlineFeaturePipelineCommandLineConfig::splice_config, OnlineFeaturePipelineCommandLineConfig::splice_feats, OnlineFeaturePipelineConfig::splice_feats, and OnlineFeaturePipelineConfig::splice_opts.

27  {
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  if (config.pitch_config != "") {
59  ReadConfigFromFile(config.pitch_config, &pitch_opts);
60  if (!add_pitch)
61  KALDI_WARN << "--pitch-config option has no effect "
62  << "since you did not supply --add-pitch option.";
63  } // else use the defaults.
64 
65  if (config.pitch_process_config != "") {
66  ReadConfigFromFile(config.pitch_process_config, &pitch_process_opts);
67  if (!add_pitch)
68  KALDI_WARN << "--pitch-process-config option has no effect "
69  << "since you did not supply --add-pitch option.";
70  } // else use the defaults.
71 
72  if (config.cmvn_config != "") {
73  ReadConfigFromFile(config.cmvn_config, &cmvn_opts);
74  } // else use the defaults.
75 
76  global_cmvn_stats_rxfilename = config.global_cmvn_stats_rxfilename;
78  KALDI_ERR << "--global-cmvn-stats option is required.";
79 
80  add_deltas = config.add_deltas;
81  if (config.delta_config != "") {
82  ReadConfigFromFile(config.delta_config, &delta_opts);
83  if (!add_deltas)
84  KALDI_WARN << "--delta-config option has no effect "
85  << "since you did not supply --add-deltas option.";
86  } // else use the defaults.
87 
88  splice_feats = config.splice_feats;
89  if (config.splice_config != "") {
90  ReadConfigFromFile(config.splice_config, &splice_opts);
91  if (!splice_feats)
92  KALDI_WARN << "--splice-config option has no effect "
93  << "since you did not supply --splice-feats option.";
94  } // else use the defaults.
95 
96  if (config.add_deltas && config.splice_feats)
97  KALDI_ERR << "You cannot supply both --add-deltas "
98  << "and --splice-feats options";
99 
100  lda_rxfilename = config.lda_rxfilename;
101 }
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...
#define KALDI_ERR
Definition: kaldi-error.h:147
#define KALDI_WARN
Definition: kaldi-error.h:150

Member Function Documentation

◆ FrameShiftInSeconds()

BaseFloat FrameShiftInSeconds ( ) const

Definition at line 286 of file online-feature-pipeline.cc.

References KALDI_ERR.

286  {
287  if (feature_type == "mfcc") {
288  return mfcc_opts.frame_opts.frame_shift_ms / 1000.0f;
289  } else if (feature_type == "plp") {
290  return plp_opts.frame_opts.frame_shift_ms / 1000.0f;
291  } else if (feature_type == "fbank") {
292  return fbank_opts.frame_opts.frame_shift_ms / 1000.0f;
293  } else {
294  KALDI_ERR << "Unknown feature type " << feature_type;
295  return 0.0;
296  }
297 }
FrameExtractionOptions frame_opts
Definition: feature-fbank.h:42
FrameExtractionOptions frame_opts
Definition: feature-plp.h:43
FrameExtractionOptions frame_opts
Definition: feature-mfcc.h:39
#define KALDI_ERR
Definition: kaldi-error.h:147

Member Data Documentation

◆ add_deltas

◆ add_pitch

◆ cmvn_opts

◆ delta_opts

◆ fbank_opts

◆ feature_type

std::string feature_type

◆ global_cmvn_stats_rxfilename

std::string global_cmvn_stats_rxfilename

◆ lda_rxfilename

◆ mfcc_opts

◆ pitch_opts

◆ pitch_process_opts

◆ plp_opts

◆ splice_feats

◆ splice_opts


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