25 int main(
int argc,
char *argv[]) {
27 using namespace kaldi;
33 "Estimate a diagonal-covariance GMM from the accumulated stats.\n" 34 "Usage: gmm-global-est [options] <model-in> <stats-in> <model-out>\n";
36 bool binary_write =
true;
39 std::string update_flags_str =
"mvw";
41 po.
Register(
"binary", &binary_write,
"Write output in binary mode");
42 po.
Register(
"update-flags", &update_flags_str,
"Which GMM parameters will be " 43 "updated: subset of mvw.");
44 po.
Register(
"mix-up", &mixup,
"Increase number of mixture components to " 45 "this overall target.");
46 po.
Register(
"perturb-factor", &perturb_factor,
"While mixing up, perturb " 47 "means by standard deviation times this factor.");
57 std::string model_in_filename = po.
GetArg(1),
58 stats_filename = po.
GetArg(2),
59 model_out_filename = po.
GetArg(3);
64 Input ki(model_in_filename, &binary_read);
71 Input ki(stats_filename, &binary);
79 &gmm, &objf_impr, &count);
80 KALDI_LOG <<
"Overall objective function improvement is " 81 << (objf_impr/
count) <<
" per frame over " 82 << (count) <<
" frames.";
86 gmm.
Split(mixup, perturb_factor);
90 KALDI_LOG <<
"Written model to " << model_out_filename;
91 }
catch(
const std::exception &e) {
92 std::cerr << e.what() <<
'\n';
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
void Split(int32 target_components, float perturb_factor, std::vector< int32 > *history=NULL)
Split the components and remember the order in which the components were split.
GmmFlagsType StringToGmmFlags(std::string str)
Convert string which is some subset of "mSwa" to flags.
void MleDiagGmmUpdate(const MleDiagGmmOptions &config, const AccumDiagGmm &diag_gmm_acc, GmmFlagsType flags, DiagGmm *gmm, BaseFloat *obj_change_out, BaseFloat *count_out, int32 *floored_elements_out, int32 *floored_gaussians_out, int32 *removed_gaussians_out)
for computing the maximum-likelihood estimates of the parameters of a Gaussian mixture model...
void PrintUsage(bool print_command_line=false)
Prints the usage documentation [provided in the constructor].
int main(int argc, char *argv[])
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 Register(OptionsItf *opts)
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.
Configuration variables like variance floor, minimum occupancy, etc.
void Read(std::istream &in_stream, bool binary, bool add)
int NumArgs() const
Number of positional parameters (c.f. argc-1).
void Read(std::istream &in, bool binary)
Definition for Gaussian Mixture Model with diagonal covariances.
void WriteKaldiObject(const C &c, const std::string &filename, bool binary)