26 int main(
int argc,
char *argv[]) {
27 using namespace kaldi;
31 "Do \"re-scaling\" re-estimation of GMM-based model\n" 32 " (this update changes the model as features change, but preserves\n" 33 " the difference between the model and the features, to keep\n" 34 " the effect of any prior discriminative training). Used in fMPE.\n" 35 " Does not update the transitions or weights.\n" 36 "Usage: gmm-est-rescale [options] <model-in> <old-stats-in> <new-stats-in> <model-out>\n" 37 "e.g.: gmm-est-rescale 1.mdl old.acc new.acc 2.mdl\n";
39 bool binary_write =
true;
46 po.
Register(
"binary", &binary_write,
"Write output in binary mode");
47 po.
Register(
"min-variance", &min_variance,
48 "Variance floor (absolute variance).");
49 po.
Register(
"min-gaussian-occupancy", &min_gaussian_occupancy,
50 "Minimum occupancy to update a Gaussian.");
59 std::string model_rxfilename = po.
GetArg(1),
60 old_stats_rxfilename = po.
GetArg(2),
61 new_stats_rxfilename = po.
GetArg(3),
62 model_wxfilename = po.
GetArg(4);
68 Input ki(model_rxfilename, &binary_read);
77 Input ki(old_stats_rxfilename, &binary);
84 Input ki(new_stats_rxfilename, &binary);
90 min_variance, min_gaussian_occupancy,
94 Output ko(model_wxfilename, binary_write);
99 KALDI_LOG <<
"Rescaled model and wrote to " << model_wxfilename;
101 }
catch(
const std::exception &e) {
102 std::cerr << e.what() <<
'\n';
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
BaseFloat min_gaussian_occupancy
Minimum count below which a Gaussian is not updated (and is removed, if remove_low_count_gaussians ==...
void PrintUsage(bool print_command_line=false)
Prints the usage documentation [provided in the constructor].
double min_variance
Minimum allowed variance in any dimension (if no variance floor) It is in double since the variance i...
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 DoRescalingUpdate(const AccumDiagGmm &old_ml_acc, const AccumDiagGmm &new_ml_acc, BaseFloat min_variance, BaseFloat min_gaussian_occupancy, DiagGmm *gmm, double *tot_count, double *tot_divergence)
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.
Configuration variables like variance floor, minimum occupancy, etc.
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 Read(std::istream &in_stream, bool binary)
void Read(std::istream &in, bool binary, bool add=false)
Read function using C++ streams.
int main(int argc, char *argv[])