22 #ifndef KALDI_TRANSFORM_FMLLR_DIAG_GMM_H_ 23 #define KALDI_TRANSFORM_FMLLR_DIAG_GMM_H_ 47 FmllrOptions(): update_type(
"full"), min_count(500.0), num_iters(40) { }
49 opts->
Register(
"fmllr-update-type", &update_type,
50 "Update type for fMLLR (\"full\"|\"diag\"|\"offset\"|\"none\")");
51 opts->
Register(
"fmllr-min-count", &min_count,
52 "Minimum count required to update fMLLR");
53 opts->
Register(
"fmllr-num-iters", &num_iters,
54 "Number of iterations in fMLLR update phase.");
72 opts_(opts) { Init(dim); }
84 void Read(std::istream &in,
bool binary,
bool add) {
86 single_frame_stats_.Init(Dim());
96 const std::vector<int32> &gselect,
101 void AccumulateFromPosteriors(
const DiagGmm &gmm,
107 void AccumulateFromPosteriorsPreselect(
109 const std::vector<int32> &gselect,
141 void Init(
int32 dim);
144 void CommitSingleFrameStats();
163 out_fmllr->
Resize(dim, dim+1);
215 std::string fmllr_type,
273 #endif // KALDI_TRANSFORM_FMLLR_DIAG_GMM_H_
void ApplyModelTransformToStats(const MatrixBase< BaseFloat > &xform, AffineXformStats *stats)
ApplyModelTransformToStats takes a transform "xform", which must be diagonal (i.e.
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
FmllrDiagGmmAccs(int32 dim, const FmllrOptions &opts=FmllrOptions())
BaseFloat ComputeFmllrMatrixDiagGmmFull(const MatrixBase< BaseFloat > &in_xform, const AffineXformStats &stats, int32 num_iters, MatrixBase< BaseFloat > *out_xform)
Updates the FMLLR matrix using Mark Gales' row-by-row update.
MatrixIndexT NumCols() const
Returns number of columns (or zero for empty matrix).
Base class which provides matrix operations not involving resizing or allocation. ...
void InitFmllr(int32 dim, Matrix< BaseFloat > *out_fmllr)
This does not work with multiple feature transforms.
SingleFrameStats single_frame_stats_
std::string update_type
"full", "diag", "offset", "none"
void SetUnit()
Sets to zero, except ones along diagonal [for non-square matrices too].
BaseFloat FmllrAuxfGradient(const MatrixBase< BaseFloat > &xform, const AffineXformStats &stats, MatrixBase< BaseFloat > *grad_out)
Returns the (diagonal-GMM) FMLLR auxiliary function value given the transform and the stats...
virtual void Register(const std::string &name, bool *ptr, const std::string &doc)=0
void ApplyFeatureTransformToStats(const MatrixBase< BaseFloat > &xform, AffineXformStats *stats)
This function applies a feature-level transform to stats (useful for certain techniques based on fMLL...
SingleFrameStats(int32 dim=0)
BaseFloat ComputeFmllrMatrixDiagGmmOffset(const MatrixBase< BaseFloat > &in_xform, const AffineXformStats &stats, MatrixBase< BaseFloat > *out_xform)
This does offset-only fMLLR, i.e. it only estimates an offset.
FmllrDiagGmmAccs(const FmllrOptions &opts=FmllrOptions())
Class for computing the maximum-likelihood estimates of the parameters of a Gaussian mixture model...
SingleFrameStats(const SingleFrameStats &s)
void Register(OptionsItf *opts)
BaseFloat ComputeFmllrMatrixDiagGmmDiagonal(const MatrixBase< BaseFloat > &in_xform, const AffineXformStats &stats, MatrixBase< BaseFloat > *out_xform)
This does diagonal fMLLR (i.e.
BaseFloat ComputeFmllrMatrixDiagGmm(const MatrixBase< BaseFloat > &in_xform, const AffineXformStats &stats, std::string fmllr_type, int32 num_iters, MatrixBase< BaseFloat > *out_xform)
This function internally calls ComputeFmllrMatrixDiagGmm{Full, Diagonal, Offset}, depending on "fmllr...
void FmllrInnerUpdate(SpMatrix< double > &inv_G, VectorBase< double > &k, double beta, int32 row, MatrixBase< double > *transform)
This function does one row of the inner-loop fMLLR transform update.
A class representing a vector.
BaseFloat ComputeFmllrDiagGmm(const FmllrDiagGmmAccs &accs, const FmllrOptions &opts, Matrix< BaseFloat > *out_fmllr, BaseFloat *logdet)
#define KALDI_ASSERT(cond)
MatrixIndexT NumRows() const
Returns number of rows (or zero for empty matrix).
float FmllrAuxFuncDiagGmm(const MatrixBase< float > &xform, const AffineXformStats &stats)
Returns the (diagonal-GMM) FMLLR auxiliary function value given the transform and the stats...
Real LogDet(Real *det_sign=NULL) const
Returns logdet of matrix.
BaseFloat ComputeFmllrMatrixDiagGmmDiagonal2(const MatrixBase< BaseFloat > &in_xform, const AffineXformStats &stats, MatrixBase< BaseFloat > *out_xform)
Definition for Gaussian Mixture Model with diagonal covariances.
BaseFloat ComputeFmllrLogDet(const Matrix< BaseFloat > &fmllr_mat)
void Resize(const MatrixIndexT r, const MatrixIndexT c, MatrixResizeType resize_type=kSetZero, MatrixStrideType stride_type=kDefaultStride)
Sets matrix to a specified size (zero is OK as long as both r and c are zero).
Provides a vector abstraction class.
FmllrDiagGmmAccs(const FmllrDiagGmmAccs &other)
Sub-matrix representation.
void Read(std::istream &in, bool binary, bool add)