31 "Compute \"pre-transform\" parameters required for estimating fMLLR with\n" 32 "SGMMs, and write to a model file, after the SGMM.\n" 33 "Usage: sgmm2-comp-prexform [options] <sgmm2-in> <occs-in> <sgmm-out>\n";
37 po.Register(
"binary", &binary,
"Write output in binary mode");
40 if (po.NumArgs() < 3) {
45 std::string sgmm_in_filename = po.GetArg(1),
46 occs_filename = po.GetArg(2),
47 sgmm_out_filename = po.GetArg(3);
54 trans_model.
Read(ki.Stream(), binary_read);
55 sgmm_in.
Read(ki.Stream(), binary_read);
62 occs.
Read(ki.Stream(), binary_read);
72 trans_model.
Write(ko.Stream(), binary);
74 fmllr_globals.
Write(ko.Stream(), binary);
77 KALDI_LOG <<
"Written model to " << sgmm_out_filename;
78 }
catch(
const std::exception &e) {
79 std::cerr << e.what() <<
'\n';
void Write(std::ostream &os, bool binary, SgmmWriteFlagsType write_params) const
Class for definition of the subspace Gmm acoustic model.
void Write(std::ostream &out_stream, bool binary) const
Matrix< BaseFloat > pre_xform_
Pre-transform matrix. Dim is [D][D+1].
void Read(std::istream &is, bool binary)
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
Matrix< BaseFloat > inv_xform_
Inverse of pre-transform. Dim is [D][D+1].
void Read(std::istream &is, bool binary)
void Write(std::ostream &os, bool binary) const
A class representing a vector.
Global adaptation parameters.
Vector< BaseFloat > mean_scatter_
Diagonal of mean-scatter matrix. Dim is [D].
void Read(std::istream &in, bool binary, bool add=false)
Read function using C++ streams.
void ComputeFmllrPreXform(const Vector< BaseFloat > &pdf_occs, Matrix< BaseFloat > *xform, Matrix< BaseFloat > *inv_xform, Vector< BaseFloat > *diag_mean_scatter) const
Computes the LDA-like pre-transform and its inverse as well as the eigenvalues of the scatter of the ...