ivector-extractor-est.cc File Reference
Include dependency graph for ivector-extractor-est.cc:

Go to the source code of this file.

Functions

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

Function Documentation

◆ main()

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

Definition at line 24 of file ivector-extractor-est.cc.

References kaldi::g_num_threads, ParseOptions::GetArg(), IvectorExtractorStats::IvectorVarianceDiagnostic(), KALDI_LOG, ParseOptions::NumArgs(), ParseOptions::PrintUsage(), ParseOptions::Read(), kaldi::ReadKaldiObject(), ParseOptions::Register(), IvectorExtractorEstimationOptions::Register(), IvectorExtractorStats::Update(), and kaldi::WriteKaldiObject().

24  {
25  try {
26  typedef kaldi::int32 int32;
27  using namespace kaldi;
28 
29  const char *usage =
30  "Do model re-estimation of iVector extractor (this is\n"
31  "the update phase of a single pass of E-M)\n"
32  "Usage: ivector-extractor-est [options] <model-in> <stats-in> <model-out>\n";
33 
34  bool binary = true;
36 
37  kaldi::ParseOptions po(usage);
38  po.Register("binary", &binary, "Write output in binary mode");
39  po.Register("num-threads", &g_num_threads,
40  "Number of threads used in update");
41 
42  update_opts.Register(&po);
43 
44  po.Read(argc, argv);
45 
46  if (po.NumArgs() != 3) {
47  po.PrintUsage();
48  exit(1);
49  }
50 
51  std::string model_rxfilename = po.GetArg(1),
52  stats_rxfilename = po.GetArg(2),
53  model_wxfilename = po.GetArg(3);
54 
55  KALDI_LOG << "Reading model";
56  IvectorExtractor extractor;
57  ReadKaldiObject(model_rxfilename, &extractor);
58 
59  KALDI_LOG << "Reading statistics";
61  ReadKaldiObject(stats_rxfilename, &stats);
62 
63  stats.Update(update_opts, &extractor);
64  WriteKaldiObject(extractor, model_wxfilename, binary);
65  stats.IvectorVarianceDiagnostic(extractor);
66 
67  KALDI_LOG << "Updated model and wrote it to "
68  << model_wxfilename;
69 
70  return 0;
71  } catch(const std::exception &e) {
72  std::cerr << e.what() << '\n';
73  return -1;
74  }
75 }
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
Definition: chain.dox:20
int32 g_num_threads
Definition: kaldi-thread.cc:25
IvectorExtractorStats is a class used to update the parameters of the ivector extractor.
kaldi::int32 int32
void ReadKaldiObject(const std::string &filename, Matrix< float > *m)
Definition: kaldi-io.cc:832
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
Definition: parse-options.h:36
double Update(const IvectorExtractorEstimationOptions &opts, IvectorExtractor *extractor) const
Returns the objf improvement per frame.
Options for training the IvectorExtractor, e.g. variance flooring.
void WriteKaldiObject(const C &c, const std::string &filename, bool binary)
Definition: kaldi-io.h:257
#define KALDI_LOG
Definition: kaldi-error.h:153
void IvectorVarianceDiagnostic(const IvectorExtractor &extractor)
Prints the proportion of the variance explained by the Ivector model versus the Gaussians.