kaldi-native-fbank C++ API
Kaldi-compatible feature extraction C++ API
Loading...
Searching...
No Matches
feature-transform.h File Reference

kaldi-native-fbank/kaldi-native-fbank/csrc/feature-transform.h More...

#include <stdint.h>
#include <string>
#include "Eigen/Core"
#include "kaldi-native-fbank/csrc/feature-matrix.h"
Include dependency graph for feature-transform.h:

Go to the source code of this file.

Classes

class  knf::FeatureTransform
 A linear (or affine) feature transform, e.g. More...

Namespaces

namespace  knf
 This file is part of kaldi-native-fbank.

Detailed Description

kaldi-native-fbank/kaldi-native-fbank/csrc/feature-transform.h

This file is part of kaldi-native-fbank.

Linear/affine feature transforms (e.g. LDA).

This is kaldi's transform-feats (see src/featbin/transform-feats.cc): it applies a stored matrix \( M \) of shape \( (D_{out} \times n) \) to feature rows \( x \) of dimension \( n \) (linear form) or \( n = D_{in}+1 \) (affine form, where the last column of \( M \) is an offset):

\[ y = x\, M^{T} \qquad\text{(linear)} \]

\[ y = x\, M_{[:,\,0:n-1]}^{T} + M_{[:,\,n-1]} \qquad\text{(affine)} \]

knf::MatrixF out = lda.Apply(feats); // (T, lda.OutputDim())
A linear (or affine) feature transform, e.g.
Definition feature-transform.h:67
static FeatureTransform Read(const std::string &filename)
Read a transform matrix from a kaldi matrix file.
MatrixF Apply(const MatrixF &feats) const
Apply the transform to a feature matrix.
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