30 using namespace kaldi;
34 "Transform GMM means with linear or affine transform\n" 35 "Usage: gmm-transform-means <transform-matrix> <model-in> <model-out>\n" 36 "e.g.: gmm-transform-means 2.mat 2.mdl 3.mdl\n";
41 po.Register(
"binary", &binary,
"Write output in binary mode");
45 if (po.NumArgs() != 3) {
50 std::string mat_rxfilename = po.GetArg(1),
51 model_in_rxfilename = po.GetArg(2),
52 model_out_wxfilename = po.GetArg(3);
61 Input ki(model_in_rxfilename, &binary_read);
62 trans_model.
Read(ki.Stream(), binary_read);
63 am_gmm.
Read(ki.Stream(), binary_read);
66 int32 dim = am_gmm.
Dim();
69 "model has dimension " << am_gmm.
Dim();
73 "model has dimension " << am_gmm.
Dim() <<
" (neither a linear nor an " 99 Output ko(model_out_wxfilename, binary);
100 trans_model.
Write(ko.Stream(), binary);
101 am_gmm.
Write(ko.Stream(), binary);
103 KALDI_LOG <<
"Written model to " << model_out_wxfilename;
105 }
catch(
const std::exception &e) {
106 std::cerr << e.what() <<
'\n';
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
MatrixIndexT NumCols() const
Returns number of columns (or zero for empty matrix).
int32 ComputeGconsts()
Sets the gconsts.
void SetMeans(const MatrixBase< Real > &m)
Use SetMeans to update only the Gaussian means (and not variances)
void CopyFromMat(const MatrixBase< OtherReal > &M, MatrixTransposeType trans=kNoTrans)
Copy given matrix. (no resize is done).
void ReadKaldiObject(const std::string &filename, Matrix< float > *m)
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
void Read(std::istream &is, bool binary)
void GetMeans(Matrix< Real > *m) const
Accessor for means.
void AddMatMat(const Real alpha, const MatrixBase< Real > &A, MatrixTransposeType transA, const MatrixBase< Real > &B, MatrixTransposeType transB, const Real beta)
DiagGmm & GetPdf(int32 pdf_index)
Accessors.
void Write(std::ostream &os, bool binary) const
MatrixIndexT NumRows() const
Returns number of rows (or zero for empty matrix).
void Write(std::ostream &out_stream, bool binary) const
Definition for Gaussian Mixture Model with diagonal covariances.
void Read(std::istream &in_stream, bool binary)
Sub-matrix representation.
void Set(Real)
Sets all elements to a specific value.