|
kaldi-native-fbank C++ API
Kaldi-compatible feature extraction C++ API
|
kaldi-native-fbank/kaldi-native-fbank/csrc/feature-cmvn.h More...

Go to the source code of this file.
Classes | |
| struct | knf::CmvnOptions |
| Options matching kaldi's apply-cmvn flags. More... | |
| class | knf::CmvnAccumulator |
| Incremental accumulator for speaker-level / streaming cmvn. More... | |
Namespaces | |
| namespace | knf |
| This file is part of kaldi-native-fbank. | |
Functions | |
| void | knf::InitCmvnStats (int32_t dim, MatrixD *stats) |
| Initialize cmvn stats to zeros in the FULL 2-row layout. | |
| void | knf::AccCmvnStats (const float *feat, int32_t dim, float weight, MatrixD *stats) |
| Accumulate stats for one frame (kaldi AccCmvnStats, same op order). | |
| void | knf::AccCmvnStats (const MatrixF &feats, MatrixD *stats) |
| Accumulate stats for a feature matrix (rows = frames). | |
| MatrixD | knf::ComputeCmvnStats (const MatrixF &feats) |
| Compute full 2-row cmvn stats for a whole matrix. | |
| void | knf::ApplyCmvn (const MatrixD &stats, const CmvnOptions &opts, MatrixF *feats) |
| Apply cmvn to feats in place (kaldi ApplyCmvn / ApplyCmvnReverse). | |
| void | knf::ApplyCmvn (const MatrixD &stats, const CmvnOptions &opts, Eigen::Ref< MatrixF > feats) |
| In-place variant taking a mutable Eigen view of the features. | |
| MatrixF | knf::ApplyCmvn (const MatrixD &stats, const CmvnOptions &opts, const MatrixF &feats) |
| Convenience version of ApplyCmvn(): returns the normalized copy. | |
kaldi-native-fbank/kaldi-native-fbank/csrc/feature-cmvn.h
This file is part of kaldi-native-fbank.
Cepstral mean and variance normalization (CMVN).
The semantics follow kaldi's src/transform/cmvn.cc exactly (same arithmetic and stats layout).
Cmvn stats layout (matches kaldi's cmvn.ark format exactly):
2-row stats (full stats, produced by InitCmvnStats/ComputeCmvnStats): row 0 = [sum_1 .. sum_D, count], row 1 = [sumsq_1 .. sumsq_D, (unused)]. Supports both mean and variance normalization.
1-row stats (mean-only stats; some pipelines only collect means): row 0 = [sum_1 .. sum_D, count]. Supports mean normalization only; requesting norm_vars with 1-row stats is an error (same as kaldi).
In both forms the frame count lives in the LAST column of row 0 (index dim); columns 0..dim-1 hold sums / sumsqs.