27 silence_weighting_config(config.silence_weighting_config) {
33 <<
"Supported feature types: mfcc, plp, fbank.";
39 KALDI_WARN <<
"--mfcc-config option has no effect " 40 <<
"since feature type is set to " <<
feature_type <<
".";
46 KALDI_WARN <<
"--plp-config option has no effect " 47 <<
"since feature type is set to " <<
feature_type <<
".";
53 KALDI_WARN <<
"--fbank-config option has no effect " 54 <<
"since feature type is set to " <<
feature_type <<
".";
64 KALDI_WARN <<
"--online-pitch-config option has no effect " 65 <<
"since you did not supply --add-pitch option.";
73 KALDI_ERR <<
"--global-cmvn-stats option is required " 74 <<
" when --cmvn-config is specified.";
81 &ivector_extraction_opts);
92 info_(info), base_feature_(NULL),
93 pitch_(NULL), pitch_feature_(NULL),
95 feature_plus_optional_pitch_(NULL),
96 feature_plus_optional_cmvn_(NULL),
97 ivector_feature_(NULL),
99 final_feature_(NULL) {
165 const std::vector<std::pair<int32, BaseFloat> > &delta_weights) {
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;
239 KALDI_ERR <<
"Unknown feature type " << feature_type;
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
int32 dim_
we cache the feature dimension, to save time when calling Dim().
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...
OnlineGenericBaseFeature< PlpComputer > OnlinePlp
bool add_pitch
Options for filterbank computation, if feature_type == "fbank".
FbankOptions fbank_opts
Options for PLP computation, if feature_type == "plp".
This configuration class is to set up OnlineNnet2FeaturePipelineInfo, which in turn is the configurat...
virtual int32 Dim() const
Member functions from OnlineFeatureInterface:
OnlineGenericBaseFeature< MfccComputer > OnlineMfcc
void UpdateFrameWeights(const std::vector< std::pair< int32, BaseFloat > > &delta_weights)
If you are downweighting silence, you can call OnlineSilenceWeighting::GetDeltaWeights and supply the...
OnlineGenericBaseFeature< FbankComputer > OnlineFbank
OnlineFeatureInterface * feature_plus_optional_pitch_
Global CMVN stats.
virtual void InputFinished()
InputFinished() tells the class you won't be providing any more waveform.
void GetAdaptationState(OnlineIvectorExtractorAdaptationState *adaptation_state) const
Get the adaptation state; you may want to call this before destroying this object, to get adaptation state that can be used to improve decoding of later utterances of this speaker.
PitchExtractionOptions pitch_opts
OnlineFeatureInterface * nnet3_feature_
iVector feature, if used.
This class does an online version of the cepstral mean and [optionally] variance, but note that this ...
virtual void AcceptWaveform(BaseFloat sampling_rate, const VectorBase< BaseFloat > &waveform)
This would be called from the application, when you get more wave data.
ProcessPitchOptions pitch_process_opts
Options for pitch extraction, if done.
virtual bool IsLastFrame(int32 frame) const
Returns true if this is the last frame.
This online-feature class implements post processing of pitch features.
OnlineCmvn * cmvn_feature_
Processed pitch, if pitch used.
virtual void GetFrame(int32 frame, VectorBase< BaseFloat > *feat)=0
Gets the feature vector for this frame.
void GetAdaptationState(OnlineIvectorExtractorAdaptationState *adaptation_state) const
Get the adaptation state; you may want to call this before destroying this object, to get adaptation state that can be used to improve decoding of later utterances of this speaker.
OnlineFeatureInterface * final_feature_
final_feature_ is feature_plus_optional_cmvn_ appended (OnlineAppendFeature) with ivector_feature_...
virtual void GetFrame(int32 frame, VectorBase< BaseFloat > *feat)
Gets the feature vector for this frame.
void InputFinished()
If you call InputFinished(), it tells the class you won't be providing any more waveform.
OnlineIvectorFeature * IvectorFeature()
This function returns the iVector-extracting part of the feature pipeline (or NULL if iVectors are no...
virtual int32 NumFramesReady() const
returns the feature dimension.
std::string online_pitch_config
This file contains a different version of the feature-extraction pipeline in online-feature-pipeline...
This class is responsible for storing configuration variables, objects and options for OnlineNnet2Fea...
void ReadKaldiObject(const std::string &filename, Matrix< float > *m)
void GetState(int32 cur_frame, OnlineCmvnState *cmvn_state)
void SetAdaptationState(const OnlineIvectorExtractorAdaptationState &adaptation_state)
Set the adaptation state to a particular value, e.g.
PlpOptions plp_opts
options for MFCC computation, if feature_type == "mfcc"
BaseFloat FrameShiftInSeconds() const
void AcceptWaveform(BaseFloat sampling_rate, const VectorBase< BaseFloat > &waveform)
Accept more data to process.
This online-feature class implements combination of two feature streams (such as pitch, plp) into one stream.
void SetState(const OnlineCmvnState &cmvn_state)
const OnlineNnet2FeaturePipelineInfo & info_
OnlineCmvnOptions cmvn_opts
Struct OnlineCmvnState stores the state of CMVN adaptation between utterances (but not the state of t...
OnlineFeatureInterface * feature_plus_optional_cmvn_
feature_plus_optional_cmvn_ is the feature_plus_optional_pitch_ transformed with OnlineCmvn if cmvn i...
virtual bool IsLastFrame(int32 frame) const =0
Returns true if this is the last frame.
OnlineBaseFeature * base_feature_
OnlineNnet2FeaturePipeline(const OnlineNnet2FeaturePipelineInfo &info)
Constructor from the "info" object.
void GetCmvnState(OnlineCmvnState *cmvn_state)
void SetAdaptationState(const OnlineIvectorExtractorAdaptationState &adaptation_state)
Set the adaptation state to a particular value, e.g.
virtual ~OnlineNnet2FeaturePipeline()
void SetCmvnState(const OnlineCmvnState &cmvn_state)
Set the CMVN state to a particular value.
void UpdateFrameWeights(const std::vector< std::pair< int32, BaseFloat > > &delta_weights)
std::string global_cmvn_stats_rxfilename
Options for online cmvn, read from config file.
std::string global_cmvn_stats_rxfilename
Matrix< double > global_cmvn_stats_
LDA matrix, if supplied.
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...
#define KALDI_ASSERT(cond)
virtual void AcceptWaveform(BaseFloat sampling_rate, const VectorBase< BaseFloat > &waveform)=0
This would be called from the application, when you get more wave data.
virtual void InputFinished()=0
InputFinished() tells the class you won't be providing any more waveform.
virtual int32 NumFramesReady() const
returns the feature dimension.
Provides a vector abstraction class.
OnlineIvectorFeature * ivector_feature_
MfccOptions mfcc_opts
"mfcc" or "plp" or "fbank"
std::string ivector_extraction_config
OnlineProcessPitch * pitch_feature_
Raw pitch, if used.
OnlineNnet2FeaturePipelineInfo()
bool use_ivectors
Filename used for reading global cmvn stats in OnlineCmvn.
virtual int32 NumFramesReady() const =0
returns the feature dimension.
OnlineIvectorExtractionInfo ivector_extractor_info
virtual int32 Dim() const =0
OnlineIvectorFeature is an online feature-extraction class that's responsible for extracting iVectors...
OnlinePitchFeature * pitch_
MFCC/PLP/filterbank.