kaldi-native-fbank C++ API
Kaldi-compatible feature extraction C++ API
Loading...
Searching...
No Matches
knf::CmvnAccumulator Class Reference

Incremental accumulator for speaker-level / streaming cmvn. More...

#include <feature-cmvn.h>

Public Member Functions

 CmvnAccumulator (int32_t dim=0)
 Construct an accumulator for features of dimension dim.
void Accumulate (const MatrixF &feats)
 Accumulate stats for a feature matrix (rows = frames); equivalent to calling Add() for each row with weight 1.0.
void Add (int32_t dim, const float *frame, float weight=1.0f)
 Accumulate stats for one frame of dimension dim, applying the same updates as the free function AccCmvnStats().
const MatrixD & Stats () const
 Return the accumulated 2-row stats: row 0 = [sums, count], row 1 = [sumsq, (unused)]; see InitCmvnStats() for the layout.

Detailed Description

Incremental accumulator for speaker-level / streaming cmvn.

It always keeps the full 2-row layout (see InitCmvnStats()) and adds up weighted frames one by one, so stats can be collected over many utterances of the same speaker and normalized later with ApplyCmvn().

Used by:
Pipelines that collect speaker-level stats incrementally (e.g. accumulate all utterances of a speaker, then normalize).
See also
AccCmvnStats, InitCmvnStats, ApplyCmvn

Constructor & Destructor Documentation

◆ CmvnAccumulator()

knf::CmvnAccumulator::CmvnAccumulator ( int32_t dim = 0)
explicit

Construct an accumulator for features of dimension dim.

Parameters
dimFeature dimension; 0 (the default) creates an empty accumulator whose stats are grown by the first Add().

Member Function Documentation

◆ Accumulate()

void knf::CmvnAccumulator::Accumulate ( const MatrixF & feats)

Accumulate stats for a feature matrix (rows = frames); equivalent to calling Add() for each row with weight 1.0.

◆ Add()

void knf::CmvnAccumulator::Add ( int32_t dim,
const float * frame,
float weight = 1.0f )

Accumulate stats for one frame of dimension dim, applying the same updates as the free function AccCmvnStats().

Parameters
dimFeature dimension; must match the dimension given to the constructor.
framePointer to one frame, a 1-D array of size dim.
weightWeight of this frame, e.g. 1.0.

◆ Stats()

const MatrixD & knf::CmvnAccumulator::Stats ( ) const
inline

Return the accumulated 2-row stats: row 0 = [sums, count], row 1 = [sumsq, (unused)]; see InitCmvnStats() for the layout.


The documentation for this class was generated from the following file:
  • /home/runner/work/kaldi-native-fbank/kaldi-native-fbank/kaldi-native-fbank/csrc/feature-cmvn.h