fmpe-init.cc File Reference
#include "base/kaldi-common.h"
#include "util/common-utils.h"
#include "transform/fmpe.h"
Include dependency graph for fmpe-init.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 fmpe-init.cc.

References ParseOptions::GetArg(), KALDI_LOG, ParseOptions::NumArgs(), ParseOptions::PrintUsage(), ParseOptions::Read(), kaldi::ReadKaldiObject(), ParseOptions::Register(), FmpeOptions::Register(), Output::Stream(), and Fmpe::Write().

24  {
25  using namespace kaldi;
26  try {
27  const char *usage =
28  "Initialize fMPE transform (to zero)\n"
29  "Usage: fmpe-init [options...] <diag-gmm-in> <fmpe-out>\n"
30  "E.g. fmpe-init 1.ubm 1.fmpe\n";
31 
32  ParseOptions po(usage);
33  FmpeOptions opts;
34  bool binary = true;
35  po.Register("binary", &binary, "If true, output fMPE object in binary mode.");
36  opts.Register(&po);
37  po.Read(argc, argv);
38 
39  if (po.NumArgs() != 2) {
40  po.PrintUsage();
41  exit(1);
42  }
43 
44  std::string dgmm_rxfilename = po.GetArg(1),
45  fmpe_wxfilename = po.GetArg(2);
46 
47  DiagGmm dgmm;
48  ReadKaldiObject(dgmm_rxfilename, &dgmm);
49 
50 
51  Fmpe fmpe(dgmm, opts);
52 
53  Output ko(fmpe_wxfilename, binary);
54  fmpe.Write(ko.Stream(), binary);
55 
56  KALDI_LOG << "Initialized fMPE object and wrote to "
57  << fmpe_wxfilename;
58  return 0;
59  } catch(const std::exception &e) {
60  std::cerr << e.what();
61  return -1;
62  }
63 }
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
Definition: chain.dox:20
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
void Register(OptionsItf *opts)
Definition: fmpe.h:75
Definition for Gaussian Mixture Model with diagonal covariances.
Definition: diag-gmm.h:42
#define KALDI_LOG
Definition: kaldi-error.h:153