27 int main(
int argc,
char *argv[]) {
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.");
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.");
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);
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);
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 PrintUsage(bool print_command_line=false)
Prints the usage documentation [provided in the constructor].
int main(int argc, char *argv[])
void Register(const std::string &name, bool *ptr, const std::string &doc)
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)
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.
MatrixIndexT Dim() const
Returns the dimension of the vector.
int NumArgs() const
Number of positional parameters (c.f. argc-1).
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)