An FMLLR (feature-space MLLR) transformation, also called CMLLR (constrained MLLR) is an affine transformation of the feature vectors. More...
#include <regtree-fmllr-diag-gmm.h>
Public Member Functions | |
RegtreeFmllrDiagGmm () | |
RegtreeFmllrDiagGmm (const RegtreeFmllrDiagGmm &other) | |
~RegtreeFmllrDiagGmm () | |
void | Init (size_t num_xforms, size_t dim) |
Allocates memory for transform matrix & bias vector. More... | |
void | Validate () |
Checks whether the various parameters are consistent. More... | |
void | SetUnit () |
Sets transform matrix to identity and bias vector to zero. More... | |
void | ComputeLogDets () |
Computes the log-determinant of the Jacobians for each transform. More... | |
void | TransformFeature (const VectorBase< BaseFloat > &in, std::vector< Vector< BaseFloat > > *out) const |
Get the transformed features for each of the transforms. More... | |
void | Write (std::ostream &out_stream, bool binary) const |
void | Read (std::istream &in_stream, bool binary) |
int32 | Dim () const |
Accessors. More... | |
int32 | NumBaseClasses () const |
int32 | NumRegClasses () const |
void | GetXformMatrix (int32 xform_index, Matrix< BaseFloat > *out) const |
void | GetLogDets (VectorBase< BaseFloat > *out) const |
int32 | Base2RegClass (int32 bclass) const |
void | SetParameters (const MatrixBase< BaseFloat > &mat, size_t regclass) |
Mutators. More... | |
void | set_bclass2xforms (const std::vector< int32 > &in) |
Private Member Functions | |
void | operator= (const RegtreeFmllrDiagGmm &) |
Private Attributes | |
int32 | dim_ |
Dimension of feature vectors. More... | |
int32 | num_xforms_ |
Number of transform matrices. More... | |
std::vector< Matrix< BaseFloat > > | xform_matrices_ |
Transform matrices. More... | |
Vector< BaseFloat > | logdet_ |
Log-determinants of the Jacobians. More... | |
bool | valid_logdet_ |
Whether logdets are for current transforms. More... | |
std::vector< int32 > | bclass2xforms_ |
For each baseclass index of which transform to use; -1 => no xform. More... | |
An FMLLR (feature-space MLLR) transformation, also called CMLLR (constrained MLLR) is an affine transformation of the feature vectors.
This class supports multiple transforms, and a regression tree. For a single, feature-level transformation see fmllr-diag-gmm-global.h Note: the "regression classes" are the classes after tree-clustering, which are smaller in number than the "base classes" (these correspond to the leaves of the tree).
Definition at line 69 of file regtree-fmllr-diag-gmm.h.
|
inline |
Definition at line 71 of file regtree-fmllr-diag-gmm.h.
|
inlineexplicit |
Definition at line 72 of file regtree-fmllr-diag-gmm.h.
|
inline |
Definition at line 77 of file regtree-fmllr-diag-gmm.h.
Definition at line 97 of file regtree-fmllr-diag-gmm.h.
Referenced by DecodableAmDiagGmmRegtreeFmllr::LogLikelihoodZeroBased().
void ComputeLogDets | ( | ) |
Computes the log-determinant of the Jacobians for each transform.
Definition at line 107 of file regtree-fmllr-diag-gmm.cc.
References RegtreeFmllrDiagGmm::dim_, KALDI_ASSERT, KALDI_ISNAN, MatrixBase< Real >::LogDet(), RegtreeFmllrDiagGmm::logdet_, RegtreeFmllrDiagGmm::num_xforms_, RegtreeFmllrDiagGmm::valid_logdet_, and RegtreeFmllrDiagGmm::xform_matrices_.
Referenced by RegtreeFmllrDiagGmm::Read().
|
inline |
Accessors.
Definition at line 92 of file regtree-fmllr-diag-gmm.h.
|
inline |
Definition at line 131 of file regtree-fmllr-diag-gmm.h.
References VectorBase< Real >::CopyFromVec(), VectorBase< Real >::Dim(), and KALDI_ASSERT.
Referenced by DecodableAmDiagGmmRegtreeFmllr::LogLikelihoodZeroBased(), and kaldi::UnitTestRegtreeFmllrDiagGmm().
Definition at line 115 of file regtree-fmllr-diag-gmm.h.
References MatrixBase< Real >::CopyFromMat(), KALDI_ERR, kaldi::kNoTrans, and Matrix< Real >::Resize().
Allocates memory for transform matrix & bias vector.
Definition at line 31 of file regtree-fmllr-diag-gmm.cc.
References RegtreeFmllrDiagGmm::dim_, KALDI_ASSERT, RegtreeFmllrDiagGmm::logdet_, RegtreeFmllrDiagGmm::num_xforms_, RegtreeFmllrDiagGmm::valid_logdet_, and RegtreeFmllrDiagGmm::xform_matrices_.
Referenced by RegtreeFmllrDiagGmmAccs::Update().
|
inline |
Definition at line 93 of file regtree-fmllr-diag-gmm.h.
Referenced by kaldi::UnitTestRegtreeFmllrDiagGmm().
|
inline |
Definition at line 94 of file regtree-fmllr-diag-gmm.h.
Referenced by DecodableAmDiagGmmRegtreeFmllr::LogLikelihoodZeroBased(), and kaldi::UnitTestRegtreeFmllrDiagGmm().
|
private |
void Read | ( | std::istream & | in_stream, |
bool | binary | ||
) |
Definition at line 168 of file regtree-fmllr-diag-gmm.cc.
References RegtreeFmllrDiagGmm::bclass2xforms_, RegtreeFmllrDiagGmm::ComputeLogDets(), RegtreeFmllrDiagGmm::dim_, kaldi::ExpectToken(), KALDI_ASSERT, RegtreeFmllrDiagGmm::num_xforms_, kaldi::ReadBasicType(), kaldi::ReadIntegerVector(), and RegtreeFmllrDiagGmm::xform_matrices_.
Referenced by kaldi::UnitTestRegtreeFmllrDiagGmm().
|
inline |
Definition at line 101 of file regtree-fmllr-diag-gmm.h.
Referenced by RegtreeFmllrDiagGmmAccs::Update().
|
inline |
Mutators.
Definition at line 125 of file regtree-fmllr-diag-gmm.h.
References kaldi::kNoTrans.
Referenced by RegtreeFmllrDiagGmmAccs::Update().
void SetUnit | ( | ) |
Sets transform matrix to identity and bias vector to zero.
Definition at line 54 of file regtree-fmllr-diag-gmm.cc.
References RegtreeFmllrDiagGmm::dim_, KALDI_ASSERT, RegtreeFmllrDiagGmm::num_xforms_, and RegtreeFmllrDiagGmm::xform_matrices_.
void TransformFeature | ( | const VectorBase< BaseFloat > & | in, |
std::vector< Vector< BaseFloat > > * | out | ||
) | const |
Get the transformed features for each of the transforms.
Definition at line 118 of file regtree-fmllr-diag-gmm.cc.
References VectorBase< Real >::Dim(), RegtreeFmllrDiagGmm::dim_, KALDI_ASSERT, KALDI_WARN, kaldi::kNoTrans, RegtreeFmllrDiagGmm::logdet_, RegtreeFmllrDiagGmm::num_xforms_, and RegtreeFmllrDiagGmm::xform_matrices_.
Referenced by DecodableAmDiagGmmRegtreeFmllr::LogLikelihoodZeroBased(), and kaldi::UnitTestRegtreeFmllrDiagGmm().
void Validate | ( | ) |
Checks whether the various parameters are consistent.
Definition at line 63 of file regtree-fmllr-diag-gmm.cc.
References RegtreeFmllrDiagGmm::bclass2xforms_, RegtreeFmllrDiagGmm::dim_, rnnlm::i, KALDI_ASSERT, KALDI_ERR, KALDI_WARN, RegtreeFmllrDiagGmm::logdet_, RegtreeFmllrDiagGmm::num_xforms_, and RegtreeFmllrDiagGmm::xform_matrices_.
Referenced by kaldi::UnitTestRegtreeFmllrDiagGmm().
void Write | ( | std::ostream & | out_stream, |
bool | binary | ||
) | const |
Definition at line 148 of file regtree-fmllr-diag-gmm.cc.
References RegtreeFmllrDiagGmm::bclass2xforms_, RegtreeFmllrDiagGmm::dim_, RegtreeFmllrDiagGmm::num_xforms_, kaldi::WriteBasicType(), kaldi::WriteIntegerVector(), kaldi::WriteToken(), and RegtreeFmllrDiagGmm::xform_matrices_.
Referenced by kaldi::UnitTestRegtreeFmllrDiagGmm().
|
private |
For each baseclass index of which transform to use; -1 => no xform.
Definition at line 110 of file regtree-fmllr-diag-gmm.h.
Referenced by RegtreeFmllrDiagGmm::Read(), RegtreeFmllrDiagGmm::Validate(), and RegtreeFmllrDiagGmm::Write().
|
private |
Dimension of feature vectors.
Definition at line 104 of file regtree-fmllr-diag-gmm.h.
Referenced by RegtreeFmllrDiagGmmAccs::AccumulateForGaussian(), RegtreeFmllrDiagGmmAccs::AccumulateForGmm(), RegtreeFmllrDiagGmm::ComputeLogDets(), RegtreeFmllrDiagGmm::Init(), RegtreeFmllrDiagGmmAccs::Init(), RegtreeFmllrDiagGmm::Read(), RegtreeFmllrDiagGmmAccs::Read(), RegtreeFmllrDiagGmm::SetUnit(), RegtreeFmllrDiagGmm::TransformFeature(), RegtreeFmllrDiagGmmAccs::Update(), RegtreeFmllrDiagGmm::Validate(), RegtreeFmllrDiagGmm::Write(), and RegtreeFmllrDiagGmmAccs::Write().
Log-determinants of the Jacobians.
Definition at line 107 of file regtree-fmllr-diag-gmm.h.
Referenced by RegtreeFmllrDiagGmm::ComputeLogDets(), RegtreeFmllrDiagGmm::Init(), RegtreeFmllrDiagGmm::TransformFeature(), and RegtreeFmllrDiagGmm::Validate().
|
private |
Number of transform matrices.
Definition at line 105 of file regtree-fmllr-diag-gmm.h.
Referenced by RegtreeFmllrDiagGmm::ComputeLogDets(), RegtreeFmllrDiagGmm::Init(), RegtreeFmllrDiagGmm::Read(), RegtreeFmllrDiagGmm::SetUnit(), RegtreeFmllrDiagGmm::TransformFeature(), RegtreeFmllrDiagGmm::Validate(), and RegtreeFmllrDiagGmm::Write().
|
private |
Whether logdets are for current transforms.
Definition at line 108 of file regtree-fmllr-diag-gmm.h.
Referenced by RegtreeFmllrDiagGmm::ComputeLogDets(), and RegtreeFmllrDiagGmm::Init().
Transform matrices.
Definition at line 106 of file regtree-fmllr-diag-gmm.h.
Referenced by RegtreeFmllrDiagGmm::ComputeLogDets(), RegtreeFmllrDiagGmm::Init(), RegtreeFmllrDiagGmm::Read(), RegtreeFmllrDiagGmm::SetUnit(), RegtreeFmllrDiagGmm::TransformFeature(), RegtreeFmllrDiagGmm::Validate(), and RegtreeFmllrDiagGmm::Write().