fgmm-global-to-gmm.cc File Reference
#include "util/common-utils.h"
#include "gmm/full-gmm.h"
#include "gmm/mle-full-gmm.h"
Include dependency graph for fgmm-global-to-gmm.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 25 of file fgmm-global-to-gmm.cc.

References DiagGmm::CopyFromFullGmm(), ParseOptions::GetArg(), KALDI_LOG, ParseOptions::NumArgs(), ParseOptions::PrintUsage(), ParseOptions::Read(), FullGmm::Read(), ParseOptions::Register(), Input::Stream(), and kaldi::WriteKaldiObject().

25  {
26  try {
27  using namespace kaldi;
28  typedef kaldi::int32 int32;
29 
30  const char *usage =
31  "Convert single full-covariance GMM to single diagonal-covariance GMM.\n"
32  "Usage: fgmm-global-to-gmm [options] 1.fgmm 1.gmm\n";
33 
34  bool binary = true;
35  ParseOptions po(usage);
36  po.Register("binary", &binary, "Write output in binary mode");
37  po.Read(argc, argv);
38 
39  if (po.NumArgs() != 2) {
40  po.PrintUsage();
41  exit(1);
42  }
43 
44  std::string fgmm_rxfilename = po.GetArg(1),
45  gmm_wxfilename = po.GetArg(2);
46 
47  FullGmm fgmm;
48 
49  {
50  bool binary_read;
51  Input ki(fgmm_rxfilename, &binary_read);
52  fgmm.Read(ki.Stream(), binary_read);
53  }
54 
55  DiagGmm gmm;
56  gmm.CopyFromFullGmm(fgmm);
57  WriteKaldiObject(gmm, gmm_wxfilename, binary);
58  KALDI_LOG << "Written diagonal GMM to " << gmm_wxfilename;
59  } catch(const std::exception &e) {
60  std::cerr << e.what() << '\n';
61  return -1;
62  }
63 }
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
Definition: chain.dox:20
Definition for Gaussian Mixture Model with full covariances.
Definition: full-gmm.h:40
kaldi::int32 int32
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
Definition: parse-options.h:36
void Read(std::istream &is, bool binary)
Definition: full-gmm.cc:813
void CopyFromFullGmm(const FullGmm &fullgmm)
Copies from given FullGmm.
Definition: diag-gmm.cc:92
Definition for Gaussian Mixture Model with diagonal covariances.
Definition: diag-gmm.h:42
void WriteKaldiObject(const C &c, const std::string &filename, bool binary)
Definition: kaldi-io.h:257
#define KALDI_LOG
Definition: kaldi-error.h:153