An MLLR mean transformation is an affine transformation of Gaussian means. More...
#include <regtree-mllr-diag-gmm.h>
Public Member Functions | |
RegtreeMllrDiagGmm () | |
void | Init (int32 num_xforms, int32 dim) |
Allocates memory for transform matrix & bias vector. More... | |
void | SetUnit () |
Initialize transform matrix to identity and bias vector to zero. More... | |
void | TransformModel (const RegressionTree ®tree, AmDiagGmm *am) |
Apply the transform(s) to all the Gaussian means in the model. More... | |
void | GetTransformedMeans (const RegressionTree ®tree, const AmDiagGmm &am, int32 pdf_index, MatrixBase< BaseFloat > *out) const |
Get all the transformed means for a given pdf. More... | |
void | Write (std::ostream &out_stream, bool binary) const |
void | Read (std::istream &in_stream, bool binary) |
void | SetParameters (const MatrixBase< BaseFloat > &mat, int32 regclass) |
Mutators. More... | |
void | set_bclass2xforms (const std::vector< int32 > &in) |
const std::vector< Matrix< BaseFloat > > | xform_matrices () const |
Accessors. More... | |
Private Member Functions | |
KALDI_DISALLOW_COPY_AND_ASSIGN (RegtreeMllrDiagGmm) | |
Private Attributes | |
std::vector< Matrix< BaseFloat > > | xform_matrices_ |
Transform matrices: size() = num_xforms_. More... | |
int32 | num_xforms_ |
Number of transforms == xform_matrices_.size() More... | |
std::vector< int32 > | bclass2xforms_ |
For each baseclass index of which transform to use; -1 => no xform. More... | |
int32 | dim_ |
Dimension of feature vectors. More... | |
An MLLR mean transformation is an affine transformation of Gaussian means.
Definition at line 53 of file regtree-mllr-diag-gmm.h.
|
inline |
Definition at line 55 of file regtree-mllr-diag-gmm.h.
void GetTransformedMeans | ( | const RegressionTree & | regtree, |
const AmDiagGmm & | am, | ||
int32 | pdf_index, | ||
MatrixBase< BaseFloat > * | out | ||
) | const |
Get all the transformed means for a given pdf.
Definition at line 84 of file regtree-mllr-diag-gmm.cc.
References VectorBase< Real >::AddMatVec(), RegtreeMllrDiagGmm::bclass2xforms_, RegtreeMllrDiagGmm::dim_, RegressionTree::Gauss2BaseclassId(), AmDiagGmm::GetGaussianMean(), AmDiagGmm::GetPdf(), KALDI_ASSERT, kaldi::kNoTrans, RegtreeMllrDiagGmm::num_xforms_, RegressionTree::NumBaseclasses(), MatrixBase< Real >::NumCols(), DiagGmm::NumGauss(), MatrixBase< Real >::NumRows(), MatrixBase< Real >::Row(), and RegtreeMllrDiagGmm::xform_matrices_.
Referenced by TestXformMean().
Allocates memory for transform matrix & bias vector.
Definition at line 29 of file regtree-mllr-diag-gmm.cc.
References RegtreeMllrDiagGmm::bclass2xforms_, RegtreeMllrDiagGmm::dim_, KALDI_ASSERT, RegtreeMllrDiagGmm::num_xforms_, and RegtreeMllrDiagGmm::xform_matrices_.
Referenced by RegtreeMllrDiagGmmAccs::Update().
|
private |
void Read | ( | std::istream & | in_stream, |
bool | binary | ||
) |
Definition at line 134 of file regtree-mllr-diag-gmm.cc.
References RegtreeMllrDiagGmm::bclass2xforms_, RegtreeMllrDiagGmm::dim_, kaldi::ExpectToken(), KALDI_ASSERT, RegtreeMllrDiagGmm::num_xforms_, kaldi::ReadBasicType(), kaldi::ReadIntegerVector(), and RegtreeMllrDiagGmm::xform_matrices_.
|
inline |
Definition at line 75 of file regtree-mllr-diag-gmm.h.
Referenced by RegtreeMllrDiagGmmAccs::Update().
|
inline |
Mutators.
Definition at line 94 of file regtree-mllr-diag-gmm.h.
References kaldi::kNoTrans.
Referenced by RegtreeMllrDiagGmmAccs::Update().
void SetUnit | ( | ) |
Initialize transform matrix to identity and bias vector to zero.
Definition at line 49 of file regtree-mllr-diag-gmm.cc.
References RegtreeMllrDiagGmm::xform_matrices_.
void TransformModel | ( | const RegressionTree & | regtree, |
AmDiagGmm * | am | ||
) |
Apply the transform(s) to all the Gaussian means in the model.
Definition at line 57 of file regtree-mllr-diag-gmm.cc.
References RegtreeMllrDiagGmm::bclass2xforms_, AmDiagGmm::ComputeGconsts(), RegtreeMllrDiagGmm::dim_, RegressionTree::GetBaseclass(), AmDiagGmm::GetGaussianMean(), KALDI_ASSERT, kaldi::kNoTrans, RegtreeMllrDiagGmm::num_xforms_, RegressionTree::NumBaseclasses(), AmDiagGmm::SetGaussianMean(), and RegtreeMllrDiagGmm::xform_matrices_.
Referenced by TestMllrAccsIO(), and TestXformMean().
void Write | ( | std::ostream & | out_stream, |
bool | binary | ||
) | const |
Definition at line 114 of file regtree-mllr-diag-gmm.cc.
References RegtreeMllrDiagGmm::bclass2xforms_, RegtreeMllrDiagGmm::dim_, RegtreeMllrDiagGmm::num_xforms_, kaldi::WriteBasicType(), kaldi::WriteIntegerVector(), kaldi::WriteToken(), and RegtreeMllrDiagGmm::xform_matrices_.
Accessors.
Definition at line 78 of file regtree-mllr-diag-gmm.h.
|
private |
For each baseclass index of which transform to use; -1 => no xform.
Definition at line 87 of file regtree-mllr-diag-gmm.h.
Referenced by RegtreeMllrDiagGmm::GetTransformedMeans(), RegtreeMllrDiagGmm::Init(), RegtreeMllrDiagGmm::Read(), RegtreeMllrDiagGmm::TransformModel(), and RegtreeMllrDiagGmm::Write().
|
private |
Dimension of feature vectors.
Definition at line 88 of file regtree-mllr-diag-gmm.h.
Referenced by RegtreeMllrDiagGmmAccs::AccumulateForGaussian(), RegtreeMllrDiagGmmAccs::AccumulateForGmm(), RegtreeMllrDiagGmm::GetTransformedMeans(), RegtreeMllrDiagGmm::Init(), RegtreeMllrDiagGmmAccs::Init(), RegtreeMllrDiagGmm::Read(), RegtreeMllrDiagGmmAccs::Read(), RegtreeMllrDiagGmm::TransformModel(), RegtreeMllrDiagGmmAccs::Update(), RegtreeMllrDiagGmm::Write(), and RegtreeMllrDiagGmmAccs::Write().
|
private |
Number of transforms == xform_matrices_.size()
Definition at line 85 of file regtree-mllr-diag-gmm.h.
Referenced by RegtreeMllrDiagGmm::GetTransformedMeans(), RegtreeMllrDiagGmm::Init(), RegtreeMllrDiagGmm::Read(), RegtreeMllrDiagGmm::TransformModel(), and RegtreeMllrDiagGmm::Write().
Transform matrices: size() = num_xforms_.
Definition at line 84 of file regtree-mllr-diag-gmm.h.
Referenced by RegtreeMllrDiagGmm::GetTransformedMeans(), RegtreeMllrDiagGmm::Init(), RegtreeMllrDiagGmm::Read(), RegtreeMllrDiagGmm::SetUnit(), RegtreeMllrDiagGmm::TransformModel(), and RegtreeMllrDiagGmm::Write().