36 "Cluster the Gaussians in a diagonal-GMM acoustic model\n" 37 "to a single full-covariance or diagonal-covariance GMM.\n" 38 "Usage: init-ubm [options] <model-file> <state-occs> <gmm-out>\n";
40 bool binary_write =
true, fullcov_ubm =
true;
42 po.Register(
"binary", &binary_write,
"Write output in binary mode");
43 po.Register(
"fullcov-ubm", &fullcov_ubm,
"Write out full covariance UBM.");
49 if (po.NumArgs() != 3) {
55 std::string model_in_filename = po.GetArg(1),
56 occs_in_filename = po.GetArg(2),
57 gmm_out_filename = po.GetArg(3);
64 trans_model.
Read(ki.Stream(), binary_read);
65 am_gmm.
Read(ki.Stream(), binary_read);
73 state_occs.
Read(ki.Stream(), binary_read);
82 full_ubm.
Write(ko.Stream(), binary_write);
85 ubm.
Write(ko.Stream(), binary_write);
88 KALDI_LOG <<
"Written UBM to " << gmm_out_filename;
89 }
catch(
const std::exception &e) {
90 std::cerr << e.what() <<
'\n';
void Write(std::ostream &os, bool binary) const
Definition for Gaussian Mixture Model with full covariances.
void Write(std::ostream &os, bool binary) const
void Resize(MatrixIndexT length, MatrixResizeType resize_type=kSetZero)
Set vector to a specified size (can be zero).
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
void ClusterGaussiansToUbm(const AmDiagGmm &am, const Vector< BaseFloat > &state_occs, UbmClusteringOptions opts, DiagGmm *ubm_out)
Clusters the Gaussians in an acoustic model to a single GMM with specified number of components...
void Read(std::istream &is, bool binary)
void Register(OptionsItf *opts)
A class representing a vector.
void CopyFromDiagGmm(const DiagGmm &diaggmm)
Copies from given DiagGmm.
Definition for Gaussian Mixture Model with diagonal covariances.
void Read(std::istream &in_stream, bool binary)
void Read(std::istream &in, bool binary, bool add=false)
Read function using C++ streams.