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");
51 if (po.NumArgs() != 3 && po.NumArgs() != 4) {
56 std::string raw_nnet_rxfilename, nnet_wxfilename;
60 if (po.NumArgs() == 4) {
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);
87 nnet.
Read(ki.Stream(), 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);
98 trans_model->
Write(ko.Stream(), binary_write);
99 am_nnet.
Write(ko.Stream(), 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 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
void Write(std::ostream &os, bool binary) const