26 int main(
int argc,
char *argv[]) {
28 using namespace kaldi;
34 "Initialize the neural network acoustic model and its associated\n" 35 "transition-model, from a tree, a topology file, and a neural-net\n" 36 "without an associated acoustic model.\n" 37 "See example scripts to see how this works in practice.\n" 39 "Usage: nnet-am-init [options] <tree-in> <topology-in> <raw-nnet-in> <nnet-am-out>\n" 40 "or: nnet-am-init [options] <transition-model-in> <raw-nnet-in> <nnet-am-out>\n" 42 " nnet-am-init tree topo \"nnet-init nnet.config - |\" 1.mdl\n";
44 bool binary_write =
true;
47 po.
Register(
"binary", &binary_write,
"Write output in binary mode");
56 std::string raw_nnet_rxfilename, nnet_wxfilename;
61 std::string tree_rxfilename = po.
GetArg(1),
62 topo_rxfilename = po.
GetArg(2);
63 raw_nnet_rxfilename = po.
GetArg(3);
64 nnet_wxfilename = po.
GetArg(4);
75 std::string trans_model_rxfilename = po.
GetArg(1);
76 raw_nnet_rxfilename = po.
GetArg(2);
77 nnet_wxfilename = po.
GetArg(3);
86 Input ki(raw_nnet_rxfilename, &binary);
92 KALDI_ERR <<
"Mismatch in number of pdfs, neural net has " 93 << am_nnet.
NumPdfs() <<
", transition model has " 97 Output ko(nnet_wxfilename, binary_write);
102 KALDI_LOG <<
"Initialized neural net and wrote it to " << nnet_wxfilename;
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 Read(std::istream &is, bool binary)
A class for storing topology information for phones.
void PrintUsage(bool print_command_line=false)
Prints the usage documentation [provided in the constructor].
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 Init(std::istream &config_is)
Initialize the neural network based acoustic model from a config file.
void Write(std::ostream &os, bool binary) 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.
int NumArgs() const
Number of positional parameters (c.f. argc-1).
void Write(std::ostream &os, bool binary) const
int main(int argc, char *argv[])