Go to the source code of this file.
|
int | main (int argc, char *argv[]) |
|
◆ main()
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 24 of file ivector-extractor-sum-accs.cc.
References ParseOptions::GetArg(), rnnlm::i, kaldi::InitKaldiInputStream(), KALDI_ERR, KALDI_LOG, ParseOptions::NumArgs(), ParseOptions::PrintUsage(), ParseOptions::Read(), IvectorExtractorStats::Read(), ParseOptions::Register(), Input::Stream(), and kaldi::WriteKaldiObject().
27 using namespace kaldi;
30 "Sum accumulators for training of iVector extractor\n" 31 "Usage: ivector-extractor-sum-accs [options] <stats-in1> " 32 "<stats-in2> ... <stats-inN> <stats-out>\n";
35 bool parallel =
false;
37 po.Register(
"binary", &binary,
"Write output in binary mode");
38 po.Register(
"parallel", ¶llel,
"If true, the program makes sure to " 39 "open all filehandles before reading for any (useful when " 40 "summing accs from long processes)");
44 if (po.NumArgs() < 2) {
49 std::string stats_wxfilename = po.GetArg(po.NumArgs());
54 std::vector<kaldi::Input*> inputs(po.NumArgs() - 1);
55 for (
int i = 1;
i < po.NumArgs();
i++) {
56 std::string stats_in_filename = po.GetArg(
i);
61 for (
size_t i = 1;
i < po.NumArgs();
i++) {
65 stats.
Read(inputs[
i-1]->Stream(), b, add);
68 KALDI_ERR <<
"Malformed input file " << po.GetArg(
i);
72 for (int32
i = 1;
i < po.NumArgs();
i++) {
73 std::string stats_rxfilename = po.GetArg(
i);
74 KALDI_LOG <<
"Reading stats from " << stats_rxfilename;
76 Input ki(stats_rxfilename, &binary_in);
78 stats.
Read(ki.Stream(), binary_in, add);
83 KALDI_LOG <<
"Wrote summed stats to " << stats_wxfilename;
86 }
catch(
const std::exception &e) {
87 std::cerr << e.what() <<
'\n';
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
bool InitKaldiInputStream(std::istream &is, bool *binary)
Initialize an opened stream for reading by detecting the binary header and.
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
void WriteKaldiObject(const C &c, const std::string &filename, bool binary)