22 #ifndef KALDI_TRANSFORM_REGTREE_FMLLR_DIAG_GMM_H_ 23 #define KALDI_TRANSFORM_REGTREE_FMLLR_DIAG_GMM_H_ 46 num_iters(10), use_regtree(true) { }
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 to estimate an fMLLR transform.");
53 opts->
Register(
"fmllr-num-iters", &num_iters,
54 "Number of fMLLR iterations (if using an iterative update).");
55 opts->
Register(
"fmllr-use-regtree", &use_regtree,
56 "Use a regression-class tree for fMLLR.");
73 : dim_(other.dim_), num_xforms_(other.num_xforms_),
74 xform_matrices_(other.xform_matrices_), logdet_(other.logdet_),
75 valid_logdet_(other.valid_logdet_),
76 bclass2xforms_(other.bclass2xforms_) {}
79 void Init(
size_t num_xforms,
size_t dim);
84 void ComputeLogDets();
88 void Write(std::ostream &out_stream,
bool binary)
const;
89 void Read(std::istream &in_stream,
bool binary);
109 std::vector<int32> bclass2xforms_;
117 if (xform_index >= num_xforms_) {
118 KALDI_ERR <<
"Index (" << xform_index <<
") out of range [0, " 119 << num_xforms_ <<
"]";
121 out->
Resize(dim_, dim_ + 1);
127 xform_matrices_[regclass].CopyFromMat(mat,
kNoTrans);
128 valid_logdet_ =
false;
153 void Init(
size_t num_bclass,
size_t dim);
170 size_t pdf_index,
size_t gauss_index,
177 void Write(std::ostream &out_stream,
bool binary)
const;
178 void Read(std::istream &in_stream,
bool binary,
bool add);
184 return baseclass_stats_;
204 #endif // KALDI_TRANSFORM_REGTREE_FMLLR_DIAG_GMM_H_
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
void DeletePointers(std::vector< A *> *v)
Deletes any non-NULL pointers in the vector v, and sets the corresponding entries of v to NULL...
~RegtreeFmllrDiagGmmAccs()
void set_bclass2xforms(const std::vector< int32 > &in)
Base class which provides matrix operations not involving resizing or allocation. ...
This class is for when you are reading something in random access, but it may actually be stored per-...
std::vector< AffineXformStats * > baseclass_stats_
Per-baseclass stats; used for accumulation.
void Register(OptionsItf *opts)
void GetLogDets(VectorBase< BaseFloat > *out) const
A templated class for writing objects to an archive or script file; see The Table concept...
int32 dim_
Dimension of feature vectors.
#define KALDI_DISALLOW_COPY_AND_ASSIGN(type)
void CopyFromMat(const MatrixBase< OtherReal > &M, MatrixTransposeType trans=kNoTrans)
Copy given matrix. (no resize is done).
TableWriter< KaldiObjectHolder< RegtreeFmllrDiagGmm > > RegtreeFmllrDiagGmmWriter
int32 NumBaseClasses() const
RandomAccessTableReaderMapped< KaldiObjectHolder< RegtreeFmllrDiagGmm > > RandomAccessRegtreeFmllrDiagGmmReaderMapped
virtual void Register(const std::string &name, bool *ptr, const std::string &doc)=0
Allows random access to a collection of objects in an archive or script file; see The Table concept...
An FMLLR (feature-space MLLR) transformation, also called CMLLR (constrained MLLR) is an affine trans...
int32 NumRegClasses() const
void CopyFromVec(const VectorBase< Real > &v)
Copy data from another vector (must match own size).
Configuration variables for FMLLR transforms.
A regression tree is a clustering of Gaussian densities in an acoustic model, such that the group of ...
A templated class for reading objects sequentially from an archive or script file; see The Table conc...
SequentialTableReader< KaldiObjectHolder< RegtreeFmllrDiagGmm > > RegtreeFmllrDiagGmmSeqReader
BaseFloat min_count
Minimum occupancy for computing a transform.
RegtreeFmllrDiagGmmAccs()
MatrixIndexT Dim() const
Returns the dimension of the vector.
bool use_regtree
If 'true', find transforms to generate using regression tree.
int32 NumBaseClasses() const
void GetXformMatrix(int32 xform_index, Matrix< BaseFloat > *out) const
int32 num_xforms_
Number of transform matrices.
int32 num_baseclasses_
Number of baseclasses.
int32 num_iters
Number of iterations (if using an iterative update)
std::vector< Matrix< BaseFloat > > xform_matrices_
Transform matrices.
void SetParameters(const MatrixBase< BaseFloat > &mat, size_t regclass)
Mutators.
A class representing a vector.
#define KALDI_ASSERT(cond)
Class for computing the accumulators needed for the maximum-likelihood estimate of FMLLR transforms f...
int32 dim_
Dimension of feature vectors.
int32 Dim() const
Accessors.
Vector< BaseFloat > logdet_
Log-determinants of the Jacobians.
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).
std::string update_type
"full", "diag", "offset", "none"
const std::vector< AffineXformStats * > & baseclass_stats() const
Provides a vector abstraction class.
RandomAccessTableReader< KaldiObjectHolder< RegtreeFmllrDiagGmm > > RandomAccessRegtreeFmllrDiagGmmReader
RegtreeFmllrDiagGmm(const RegtreeFmllrDiagGmm &other)
int32 Dim() const
Accessors.
bool valid_logdet_
Whether logdets are for current transforms.
int32 Base2RegClass(int32 bclass) const