30 int main(
int argc,
char *argv[]) {
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.");
55 std::string model_in_filename = po.
GetArg(1),
56 occs_in_filename = po.
GetArg(2),
57 gmm_out_filename = po.
GetArg(3);
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 PrintUsage(bool print_command_line=false)
Prints the usage documentation [provided in the constructor].
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).
void Register(const std::string &name, bool *ptr, const std::string &doc)
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)
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).
void Register(OptionsItf *opts)
A class representing a vector.
void CopyFromDiagGmm(const DiagGmm &diaggmm)
Copies from given DiagGmm.
int main(int argc, char *argv[])
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.