57 using namespace kaldi;
60 typedef kaldi::int64 int64;
63 "Get frame-by-frame examples of data for nnet3 neural network training.\n" 64 "This is like nnet3-get-egs, but does not split up its inputs into pieces\n" 65 "and allows more general generation of egs. E.g. this is usable for image\n" 66 "recognition tasks.\n" 68 "Usage: nnet3-get-egs-simple [options] <name1>=<rspecifier1> " 69 "<name2>=<rspecifier2> ...\n" 72 "nnet3-get-egs-simple input=scp:images.scp \\\n" 73 "output='ark,o:ali-to-post ark:labels.txt ark:- | post-to-smat --dim=10 ark:- ark:-' ark:egs.ark\n" 75 "See also: nnet3-get-egs\n";
83 if (po.NumArgs() < 2) {
89 std::string examples_wspecifier = po.GetArg(po.NumArgs());
93 std::string first_name, first_reader_name;
97 std::vector<std::string> other_names;
99 std::vector<RandomAccessGeneralMatrixReader*> other_readers;
101 for (int32
i = 2;
i < po.NumArgs();
i++) {
102 std::string name, rspecifier;
104 other_names.push_back(name);
108 int32 num_done = 0, num_err = 0;
110 for (; !first_reader.Done(); first_reader.Next()) {
111 std::string key = first_reader.Key();
116 eg.
io.push_back(
NnetIo(first_name, t, feats));
118 for (
size_t i = 0;
i < other_names.size();
i++) {
119 if (!other_readers[
i]->HasKey(key)) {
120 KALDI_WARN <<
"Could not find input for key " << key
121 <<
" for io-name=" << other_names[
i];
126 eg.
io.push_back(
NnetIo(other_names[
i], t, other_feats));
131 example_writer.Write(key, eg);
136 KALDI_WARN << num_err <<
" utterances had errors and could " 138 return (num_done > 0 ? 0 : 1);
139 }
catch(
const std::exception &e) {
140 std::cerr << e.what() <<
'\n';
NnetExample is the input data and corresponding label (or labels) for one or more frames of input...
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
This class is a wrapper that enables you to store a matrix in one of three forms: either as a Matrix<...
void SplitArgOnEquals(const std::string &arg, std::string *name, std::string *rspecifier)
A templated class for writing objects to an archive or script file; see The Table concept...
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
A templated class for reading objects sequentially from an archive or script file; see The Table conc...
RandomAccessTableReader< KaldiObjectHolder< GeneralMatrix > > RandomAccessGeneralMatrixReader
std::vector< NnetIo > io
"io" contains the input and output.