Class for computing the accumulators needed for the maximum-likelihood estimate of FMLLR transforms for a subspace GMM acoustic model. More...
#include <fmllr-sgmm2.h>
Public Member Functions | |
FmllrSgmm2Accs () | |
~FmllrSgmm2Accs () | |
void | Init (int32 dim, int32 num_gaussians) |
void | SetZero () |
void | Write (std::ostream &out_stream, bool binary) const |
void | Read (std::istream &in_stream, bool binary, bool add) |
BaseFloat | Accumulate (const AmSgmm2 &sgmm, const VectorBase< BaseFloat > &data, const Sgmm2PerFrameDerivedVars &frame_vars, int32 state_index, BaseFloat weight, Sgmm2PerSpkDerivedVars *spk) |
Accumulation routine that computes the Gaussian posteriors and calls the AccumulateFromPosteriors function with the computed posteriors. More... | |
void | AccumulateFromPosteriors (const AmSgmm2 &sgmm, const Sgmm2PerSpkDerivedVars &spk, const VectorBase< BaseFloat > &data, const std::vector< int32 > &gauss_select, const Matrix< BaseFloat > &posteriors, int32 state_index) |
void | AccumulateForFmllrSubspace (const AmSgmm2 &sgmm, const Sgmm2FmllrGlobalParams &fmllr_globals, SpMatrix< double > *grad_scatter) |
BaseFloat | FmllrObjGradient (const AmSgmm2 &sgmm, const Matrix< BaseFloat > &xform, Matrix< BaseFloat > *grad_out, Matrix< BaseFloat > *G_out) const |
bool | Update (const AmSgmm2 &model, const Sgmm2FmllrGlobalParams &fmllr_globals, const Sgmm2FmllrConfig &opts, Matrix< BaseFloat > *out_xform, BaseFloat *frame_count, BaseFloat *auxf_improv) const |
Computes the FMLLR transform from the accumulated stats, using the pre-transforms in fmllr_globals. More... | |
int32 | Dim () const |
Accessors. More... | |
const AffineXformStats & | stats () const |
Private Member Functions | |
KALDI_DISALLOW_COPY_AND_ASSIGN (FmllrSgmm2Accs) | |
Private Attributes | |
AffineXformStats | stats_ |
Accumulated stats. More... | |
int32 | dim_ |
Dimension of feature vectors. More... | |
Class for computing the accumulators needed for the maximum-likelihood estimate of FMLLR transforms for a subspace GMM acoustic model.
Definition at line 122 of file fmllr-sgmm2.h.
|
inline |
Definition at line 124 of file fmllr-sgmm2.h.
|
inline |
Definition at line 125 of file fmllr-sgmm2.h.
BaseFloat Accumulate | ( | const AmSgmm2 & | sgmm, |
const VectorBase< BaseFloat > & | data, | ||
const Sgmm2PerFrameDerivedVars & | frame_vars, | ||
int32 | state_index, | ||
BaseFloat | weight, | ||
Sgmm2PerSpkDerivedVars * | spk | ||
) |
Accumulation routine that computes the Gaussian posteriors and calls the AccumulateFromPosteriors function with the computed posteriors.
The 'data' argument is not FMLLR-transformed and is needed in addition to the the 'frame_vars' since the latter only contains a copy of the transformed feature vector.
Definition at line 156 of file fmllr-sgmm2.cc.
References AmSgmm2::ComponentPosteriors(), Sgmm2PerFrameDerivedVars::gselect, and MatrixBase< Real >::Scale().
Referenced by TestSgmm2FmllrAccsIO(), and TestSgmm2FmllrSubspace().
void AccumulateForFmllrSubspace | ( | const AmSgmm2 & | sgmm, |
const Sgmm2FmllrGlobalParams & | fmllr_globals, | ||
SpMatrix< double > * | grad_scatter | ||
) |
Definition at line 205 of file fmllr-sgmm2.cc.
References SpMatrix< Real >::AddVec2(), kaldi::ApplyHessianXformToGradient(), kaldi::ApplyPreXformToGradient(), VectorBase< Real >::CopyRowsFromMat(), AmSgmm2::FeatureDim(), KALDI_LOG, KALDI_WARN, kaldi::kSetZero, kaldi::kUndefined, VectorBase< Real >::Scale(), and MatrixBase< Real >::SetUnit().
Referenced by TestSgmm2FmllrSubspace().
void AccumulateFromPosteriors | ( | const AmSgmm2 & | sgmm, |
const Sgmm2PerSpkDerivedVars & | spk, | ||
const VectorBase< BaseFloat > & | data, | ||
const std::vector< int32 > & | gauss_select, | ||
const Matrix< BaseFloat > & | posteriors, | ||
int32 | state_index | ||
) |
Definition at line 171 of file fmllr-sgmm2.cc.
References SpMatrix< Real >::AddVec2(), AmSgmm2::GetVarScaledSubstateSpeakerMean(), rnnlm::i, kaldi::kSetZero, AmSgmm2::NumSubstatesForGroup(), AmSgmm2::Pdf2Group(), and VectorBase< Real >::Range().
Referenced by kaldi::AccumulateForUtterance().
|
inline |
BaseFloat FmllrObjGradient | ( | const AmSgmm2 & | sgmm, |
const Matrix< BaseFloat > & | xform, | ||
Matrix< BaseFloat > * | grad_out, | ||
Matrix< BaseFloat > * | G_out | ||
) | const |
Definition at line 229 of file fmllr-sgmm2.cc.
References MatrixBase< Real >::AddMat(), MatrixBase< Real >::AddSpMat(), MatrixBase< Real >::CopyFromMat(), AmSgmm2::FeatureDim(), AmSgmm2::GetInvCovars(), rnnlm::i, KALDI_ASSERT, kaldi::kNoTrans, kaldi::kSetZero, kaldi::kTrans, MatrixBase< Real >::LogDet(), AmSgmm2::NumGauss(), MatrixBase< Real >::Range(), MatrixBase< Real >::Scale(), and kaldi::TraceMatMat().
Definition at line 146 of file fmllr-sgmm2.cc.
Referenced by main(), TestSgmm2FmllrAccsIO(), and TestSgmm2FmllrSubspace().
|
private |
Definition at line 275 of file fmllr-sgmm2.cc.
References kaldi::ExpectToken(), KALDI_ASSERT, and kaldi::ReadBasicType().
Referenced by TestSgmm2FmllrAccsIO().
|
inline |
Definition at line 128 of file fmllr-sgmm2.h.
Referenced by main().
|
inline |
Definition at line 172 of file fmllr-sgmm2.h.
bool Update | ( | const AmSgmm2 & | model, |
const Sgmm2FmllrGlobalParams & | fmllr_globals, | ||
const Sgmm2FmllrConfig & | opts, | ||
Matrix< BaseFloat > * | out_xform, | ||
BaseFloat * | frame_count, | ||
BaseFloat * | auxf_improv | ||
) | const |
Computes the FMLLR transform from the accumulated stats, using the pre-transforms in fmllr_globals.
Expects the transform matrix out_xform to be initialized to the correct size. Returns true if the transform was updated (i.e. had enough counts).
Definition at line 356 of file fmllr-sgmm2.cc.
References MatrixBase< Real >::AddMat(), kaldi::ApplyHessianXformToGradient(), kaldi::ApplyInvHessianXformToChange(), kaldi::ApplyInvPreXformToChange(), kaldi::ApplyPreXformToGradient(), kaldi::AssertEqual(), Sgmm2FmllrConfig::bases_occ_scale, kaldi::CalcFmllrStepSize(), MatrixBase< Real >::CopyFromMat(), Sgmm2FmllrGlobalParams::fmllr_bases_, Sgmm2FmllrConfig::fmllr_iters, Sgmm2FmllrConfig::fmllr_min_count, Sgmm2FmllrConfig::fmllr_min_count_basis, Sgmm2FmllrConfig::fmllr_min_count_full, Sgmm2FmllrGlobalParams::HasBasis(), Sgmm2FmllrGlobalParams::IsEmpty(), KALDI_ASSERT, KALDI_ERR, KALDI_LOG, KALDI_VLOG, KALDI_WARN, kaldi::kNoTrans, kaldi::kSetZero, kaldi::kTrans, kaldi::kUndefined, MatrixBase< Real >::LogDet(), Sgmm2FmllrConfig::num_fmllr_bases, MatrixBase< Real >::NumCols(), MatrixBase< Real >::NumRows(), MatrixBase< Real >::Scale(), MatrixBase< Real >::SetZero(), and kaldi::TraceMatMat().
Referenced by main(), TestSgmm2FmllrAccsIO(), and TestSgmm2FmllrSubspace().
void Write | ( | std::ostream & | out_stream, |
bool | binary | ||
) | const |
Definition at line 266 of file fmllr-sgmm2.cc.
References kaldi::WriteBasicType(), and kaldi::WriteToken().
Referenced by TestSgmm2FmllrAccsIO().
|
private |
Dimension of feature vectors.
Definition at line 176 of file fmllr-sgmm2.h.
|
private |
Accumulated stats.
Definition at line 175 of file fmllr-sgmm2.h.