29 using namespace kaldi;
34 "Get statistics derivative for GMM models\n" 35 "(used in fMPE/fMMI feature-space discriminative training)\n" 36 "Usage: gmm-get-stats-deriv [options] <model-in> <num-stats-in>" 37 " <den-stats-in> <ml-stats-in> <deriv-out>\n" 38 "e.g. (for fMMI/fBMMI): gmm-get-stats-deriv 1.mdl 1.acc 2.mdl\n";
40 bool binary_write =
true;
47 po.Register(
"binary", &binary_write,
"Write output in binary mode");
48 po.Register(
"min-variance", &min_variance,
49 "Variance floor (absolute variance).");
50 po.Register(
"min-gaussian-occupancy", &min_gaussian_occupancy,
51 "Minimum occupancy to update a Gaussian.");
55 if (po.NumArgs() != 5) {
60 std::string model_rxfilename = po.GetArg(1),
61 num_stats_rxfilename = po.GetArg(2),
62 den_stats_rxfilename = po.GetArg(3),
63 ml_stats_rxfilename = po.GetArg(4),
64 deriv_wxfilename = po.GetArg(5);
70 Input ki(model_rxfilename, &binary_read);
71 trans_model.
Read(ki.Stream(), binary_read);
72 am_gmm.
Read(ki.Stream(), binary_read);
80 Input ki(num_stats_rxfilename, &binary_read);
81 transition_accs.
Read(ki.Stream(), binary_read);
82 num_stats.
Read(ki.Stream(), binary_read,
false);
86 Input ki(den_stats_rxfilename, &binary_read);
87 transition_accs.
Read(ki.Stream(), binary_read);
88 den_stats.
Read(ki.Stream(), binary_read,
false);
92 Input ki(ml_stats_rxfilename, &binary_read);
93 transition_accs.
Read(ki.Stream(), binary_read);
94 ml_stats.
Read(ki.Stream(), binary_read,
false);
102 min_variance, min_gaussian_occupancy,
107 KALDI_LOG <<
"Computed model derivative and wrote it to " 111 }
catch(
const std::exception &e) {
112 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 ==...
double min_variance
Minimum allowed variance in any dimension (if no variance floor) It is in double since the variance i...
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
void GetStatsDerivative(const DiagGmm &gmm, const AccumDiagGmm &num_acc, const AccumDiagGmm &den_acc, const AccumDiagGmm &ml_acc, BaseFloat min_variance, BaseFloat min_gaussian_occupancy, AccumDiagGmm *out_accs)
void Read(std::istream &is, bool binary)
Configuration variables like variance floor, minimum occupancy, etc.
void Read(std::istream &in_stream, bool binary, bool add=false)
void WriteKaldiObject(const C &c, const std::string &filename, bool binary)
void Read(std::istream &in_stream, bool binary)
void Read(std::istream &in, bool binary, bool add=false)
Read function using C++ streams.