All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ivector-extractor-init.cc File Reference
Include dependency graph for ivector-extractor-init.cc:

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 27 of file ivector-extractor-init.cc.

References ParseOptions::GetArg(), IvectorExtractor::IvectorDim(), KALDI_LOG, ParseOptions::NumArgs(), ParseOptions::PrintUsage(), ParseOptions::Read(), kaldi::ReadKaldiObject(), ParseOptions::Register(), IvectorExtractorOptions::Register(), and kaldi::WriteKaldiObject().

27  {
28  try {
29  using namespace kaldi;
30  using kaldi::int32;
31 
32  const char *usage =
33  "Initialize ivector-extractor\n"
34  "Usage: ivector-extractor-init [options] <fgmm-in> <ivector-extractor-out>\n"
35  "e.g.:\n"
36  " ivector-extractor-init 4.fgmm 0.ie\n";
37 
38  bool binary = true;
39  IvectorExtractorOptions ivector_opts;
40  ParseOptions po(usage);
41  po.Register("binary", &binary, "Write output in binary mode");
42  ivector_opts.Register(&po);
43 
44  po.Read(argc, argv);
45 
46  if (po.NumArgs() != 2) {
47  po.PrintUsage();
48  exit(1);
49  }
50 
51 
52  std::string fgmm_rxfilename = po.GetArg(1),
53  ivector_extractor_wxfilename = po.GetArg(2);
54 
55  FullGmm fgmm;
56  ReadKaldiObject(fgmm_rxfilename, &fgmm);
57 
58  IvectorExtractor extractor(ivector_opts, fgmm);
59 
60  WriteKaldiObject(extractor, ivector_extractor_wxfilename, binary);
61 
62  KALDI_LOG << "Initialized iVector extractor with iVector dimension "
63  << extractor.IvectorDim() << " and wrote it to "
64  << ivector_extractor_wxfilename;
65  return 0;
66  } catch(const std::exception &e) {
67  std::cerr << e.what();
68  return -1;
69  }
70 }
Relabels neural network egs with the read pdf-id alignments.
Definition: chain.dox:20
Definition for Gaussian Mixture Model with full covariances.
Definition: full-gmm.h:40
void ReadKaldiObject(const std::string &filename, Matrix< float > *m)
Definition: kaldi-io.cc:818
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
Definition: parse-options.h:36
void Register(OptionsItf *opts)
void WriteKaldiObject(const C &c, const std::string &filename, bool binary)
Definition: kaldi-io.h:257
#define KALDI_LOG
Definition: kaldi-error.h:133