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.");
51 if (po.NumArgs() != 3) {
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);
64 fgmm.
Read(ki.Stream(), binary_read);
70 Input ki(stats_filename, &binary);
71 gmm_accs.
Read(ki.Stream(), binary,
true );
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...
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.
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...
Class for computing the maximum-likelihood estimates of the parameters of a Gaussian mixture model...
void Read(std::istream &is, bool binary)
void Read(std::istream &in_stream, bool binary, bool add)
void WriteKaldiObject(const C &c, const std::string &filename, bool binary)