8#ifndef KALDI_NATIVE_FBANK_CSRC_ONLINE_CMVN_H_
9#define KALDI_NATIVE_FBANK_CSRC_ONLINE_CMVN_H_
144 int32_t
Dim()
const {
return dim_; }
211 void UpdateStats(
const VectorF &feat);
213 void NormalizeFrame(
VectorF *feat)
const;
216 std::vector<int32_t> skip_dims_;
218 int32_t num_frames_ = 0;
223 std::vector<VectorF> raw_ring_;
227 MatrixD prev_speaker_cmvn_stats_;
OnlineCmvn(const OnlineCmvnOptions &opts, const OnlineCmvnState &state)
Construct with options and adaptation state.
int32_t NumFramesAccepted() const
Number of frames accepted so far.
Definition online-cmvn.h:146
void Freeze()
Freeze the normalization at the current frame.
VectorF AcceptFeature(const float *feat, int32_t dim)
Push one raw feature frame; return the normalized frame.
VectorF AcceptFeature(const VectorF &feat)
Same as AcceptFeature(const float *, int32_t).
OnlineCmvnState GetState() const
Return the adaptation state for the next utterance.
MatrixF AcceptFeatures(const MatrixF &feats)
Push a batch of raw feature frames.
static void SmoothOnlineCmvnStats(const MatrixD &speaker_stats, const MatrixD &global_stats, const OnlineCmvnOptions &opts, MatrixD *stats)
Smooth window stats with speaker and global stats.
int32_t Dim() const
Feature dimension (dim of the global stats minus one).
Definition online-cmvn.h:144
kaldi-native-fbank/kaldi-native-fbank/csrc/feature-matrix.h
This file is part of kaldi-native-fbank.
Definition feature-cmvn.h:42
Eigen::Matrix< float, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > MatrixF
Row-major feature matrix: rows are frames, columns are features.
Definition feature-matrix.h:26
Eigen::VectorXf VectorF
1-D feature/aux vector (float).
Definition feature-matrix.h:35
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > MatrixD
Double-precision accumulator/statistics matrix (e.g.
Definition feature-matrix.h:31
Options for OnlineCmvn, mirroring kaldi's OnlineCmvnOptions (kaldi/src/feat/online-feature....
Definition online-cmvn.h:28
int32_t global_frames
Number of frames of global-average stats to back off to further, when even the speaker stats cannot f...
Definition online-cmvn.h:39
bool normalize_mean
If true (default), subtract the running mean.
Definition online-cmvn.h:42
std::string ToString() const
Return the options as a string.
int32_t ring_buffer_size
Size of kaldi's ring buffer for cached stats snapshots.
Definition online-cmvn.h:53
int32_t modulus
How often kaldi snapshots stats internally (every modulus frames).
Definition online-cmvn.h:50
bool normalize_variance
If true, also divide by the running standard deviation (kaldi: –norm-vars).
Definition online-cmvn.h:46
int32_t cmn_window
Number of frames of sliding context for cepstral mean normalization (kaldi: –cmn-window).
Definition online-cmvn.h:32
int32_t speaker_frames
Number of frames of previous utterance(s) from this speaker to back off to at the beginning of an utt...
Definition online-cmvn.h:36
std::string skip_dims
Colon-separated list of dimensions to skip normalization of, e.g.
Definition online-cmvn.h:57
State of CMVN adaptation between utterances (not the within-utterance computation state).
Definition online-cmvn.h:73
OnlineCmvnState()=default
MatrixD frozen_state
If non-empty, 2 x (dim+1): the "frozen" normalization in use since OnlineCmvn::Freeze() was called (k...
Definition online-cmvn.h:83
OnlineCmvnState(const MatrixD &global_stats)
Construct with global stats (the required part of the state).
Definition online-cmvn.h:87
MatrixD speaker_cmvn_stats
Total CMVN stats for this speaker up till now, 2 x (dim+1); may be empty at the very first utterance.
Definition online-cmvn.h:76
MatrixD global_cmvn_stats
Global CMVN stats, 2 x (dim+1), e.g.
Definition online-cmvn.h:79