28 int main(
int argc,
char *argv[]) {
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");
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);
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);
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).
void PrintUsage(bool print_command_line=false)
Prints the usage documentation [provided in the constructor].
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 Register(const std::string &name, bool *ptr, const std::string &doc)
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)
int Read(int argc, const char *const *argv)
Parses the command line options and fills the ParseOptions-registered variables.
std::string GetArg(int param) const
Returns one of the positional parameters; 1-based indexing for argc/argv compatibility.
int NumArgs() const
Number of positional parameters (c.f. argc-1).
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.