25 int main(
int argc,
char *argv[]) {
27 using namespace kaldi;
32 "Estimate a full-covariance GMM from the accumulated stats.\n" 33 "Usage: fgmm-global-est [options] <model-in> <stats-in> <model-out>\n";
35 bool binary_write =
true;
38 std::string update_flags_str =
"mvw";
40 po.
Register(
"binary", &binary_write,
"Write output in binary mode");
41 po.
Register(
"update-flags", &update_flags_str,
"Which GMM parameters will be " 42 "updated: subset of mvw.");
43 po.
Register(
"mix-up", &mixup,
"Increase number of mixture components to " 44 "this overall target.");
45 po.
Register(
"perturb-factor", &perturb_factor,
"While mixing up, perturb " 46 "means by standard deviation times this factor.");
56 std::string model_in_filename = po.
GetArg(1),
57 stats_filename = po.
GetArg(2),
58 model_out_filename = po.
GetArg(3);
63 Input ki(model_in_filename, &binary_read);
70 Input ki(stats_filename, &binary);
77 &fgmm, &objf_impr, &count);
78 KALDI_LOG <<
"Overall objective function improvement is " 79 << (objf_impr/
count) <<
" per frame over " 80 << (count) <<
" frames.";
84 fgmm.
Split(mixup, perturb_factor);
88 KALDI_LOG <<
"Written model to " << model_out_filename;
89 }
catch(
const std::exception &e) {
90 std::cerr << e.what() <<
'\n';
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
int main(int argc, char *argv[])
GmmFlagsType StringToGmmFlags(std::string str)
Convert string which is some subset of "mSwa" to flags.
Configuration variables like variance floor, minimum occupancy, etc.
void Split(int32 target_components, float perturb_factor, std::vector< int32 > *history=NULL)
Merge the components and remember the order in which the components were merged (flat list of pairs) ...
Definition for Gaussian Mixture Model with full covariances.
void PrintUsage(bool print_command_line=false)
Prints the usage documentation [provided in the constructor].
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)
void MleFullGmmUpdate(const MleFullGmmOptions &config, const AccumFullGmm &fullgmm_acc, GmmFlagsType flags, FullGmm *gmm, BaseFloat *obj_change_out, BaseFloat *count_out)
for computing the maximum-likelihood estimates of the parameters of a Gaussian mixture model...
int Read(int argc, const char *const *argv)
Parses the command line options and fills the ParseOptions-registered variables.
Class for computing the maximum-likelihood estimates of the parameters of a Gaussian mixture model...
std::string GetArg(int param) const
Returns one of the positional parameters; 1-based indexing for argc/argv compatibility.
void Read(std::istream &is, bool binary)
void Read(std::istream &in_stream, bool binary, bool add)
int NumArgs() const
Number of positional parameters (c.f. argc-1).
void WriteKaldiObject(const C &c, const std::string &filename, bool binary)