29 using namespace kaldi;
33 "Does GMM mixing up (and Gaussian merging)\n" 34 "Usage: gmm-mixup [options] <model-in> <state-occs-in> <model-out>\n" 35 "e.g. of mixing up:\n" 36 " gmm-mixup --mix-up=4000 1.mdl 1.occs 2.mdl\n" 38 " gmm-mixup --mix-down=2000 1.mdl 1.occs 2.mdl\n";
40 bool binary_write =
true;
48 po.Register(
"binary", &binary_write,
"Write output in binary mode");
49 po.Register(
"mix-up", &mixup,
"Increase number of mixture components to " 50 "this overall target.");
51 po.Register(
"min-count", &min_count,
52 "Minimum count enforced while mixing up.");
53 po.Register(
"mix-down", &mixdown,
"If nonzero, merge mixture components to this " 55 po.Register(
"power", &power,
"If mixing up, power to allocate Gaussians to" 57 po.Register(
"perturb-factor", &perturb_factor,
"While mixing up, perturb " 58 "means by standard deviation times this factor.");
62 if (po.NumArgs() != 3) {
68 std::string model_in_filename = po.GetArg(1),
69 occs_in_filename = po.GetArg(2),
70 model_out_filename = po.GetArg(3);
76 Input ki(model_in_filename, &binary_read);
77 trans_model.
Read(ki.Stream(), binary_read);
78 am_gmm.
Read(ki.Stream(), binary_read);
81 if (mixup != 0 || mixdown != 0) {
86 KALDI_ERR <<
"Dimension of state occupancies " << occs.
Dim()
87 <<
" does not match num-pdfs " << am_gmm.
NumPdfs();
98 Output ko(model_out_filename, binary_write);
99 trans_model.
Write(ko.Stream(), binary_write);
100 am_gmm.
Write(ko.Stream(), binary_write);
103 KALDI_LOG <<
"Written model to " << model_out_filename;
104 }
catch(
const std::exception &e) {
105 std::cerr << e.what() <<
'\n';
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
void MergeByCount(const Vector< BaseFloat > &state_occs, int32 target_components, BaseFloat power, BaseFloat min_count)
void ReadKaldiObject(const std::string &filename, Matrix< float > *m)
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
void Read(std::istream &is, bool binary)
MatrixIndexT Dim() const
Returns the dimension of the vector.
void Write(std::ostream &os, bool binary) const
A class representing a vector.
void Write(std::ostream &out_stream, bool binary) const
void Read(std::istream &in_stream, bool binary)
void SplitByCount(const Vector< BaseFloat > &state_occs, int32 target_components, float perturb_factor, BaseFloat power, BaseFloat min_count)