27 int main(
int argc,
char *argv[]) {
29 using namespace kaldi;
33 "Do EBW update for MMI, MPE or MCE discriminative training.\n" 34 "Numerator stats should already be I-smoothed (e.g. use gmm-ismooth-stats)\n" 35 "Usage: gmm-est-gaussians-ebw [options] <model-in> <stats-num-in> <stats-den-in> <model-out>\n" 36 "e.g.: gmm-est-gaussians-ebw 1.mdl num.acc den.acc 2.mdl\n";
38 bool binary_write =
false;
39 std::string update_flags_str =
"mv";
43 po.
Register(
"binary", &binary_write,
"Write output in binary mode");
44 po.
Register(
"update-flags", &update_flags_str,
"Which GMM parameters to " 45 "update: e.g. m or mv (w, t ignored).");
59 std::string model_in_filename = po.
GetArg(1),
60 num_stats_filename = po.
GetArg(2),
61 den_stats_filename = po.
GetArg(3),
62 model_out_filename = po.
GetArg(4);
68 Input ki(model_in_filename, &binary_read);
80 Input ki(num_stats_filename, &binary);
87 Input ki(den_stats_filename, &binary);
97 &auxf_impr, &count, &num_floored);
100 KALDI_LOG <<
"Overall auxf impr/frame from Gaussian update is " << (auxf_impr/
count)
101 <<
" over " << count <<
" frames; floored D for " 102 << num_floored <<
" Gaussians.";
106 Output ko(model_out_filename, binary_write);
111 KALDI_LOG <<
"Written model to " << model_out_filename;
113 }
catch(
const std::exception &e) {
114 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.
int main(int argc, char *argv[])
void PrintUsage(bool print_command_line=false)
Prints the usage documentation [provided in the constructor].
uint16 GmmFlagsType
Bitwise OR of the above flags.
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 Read(std::istream &is, bool binary)
BaseFloat TotStatsCount() const
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.
void Read(std::istream &in_stream, bool binary, bool add=false)
int NumArgs() const
Number of positional parameters (c.f. argc-1).
void Write(std::ostream &os, bool binary) const
void Write(std::ostream &out_stream, bool binary) const
void UpdateEbwAmDiagGmm(const AccumAmDiagGmm &num_stats, const AccumAmDiagGmm &den_stats, GmmFlagsType flags, const EbwOptions &opts, AmDiagGmm *am_gmm, BaseFloat *auxf_change_out, BaseFloat *count_out, int32 *num_floored_out)
void Read(std::istream &in_stream, bool binary)
void Read(std::istream &in, bool binary, bool add=false)
Read function using C++ streams.
void Register(OptionsItf *opts)