gmm-global-copy.cc File Reference
#include "base/kaldi-common.h"
#include "util/common-utils.h"
#include "gmm/diag-gmm.h"
Include dependency graph for gmm-global-copy.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 gmm-global-copy.cc.

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

24  {
25  try {
26  using namespace kaldi;
27  typedef kaldi::int32 int32;
28 
29  const char *usage =
30  "Copy a diagonal-covariance GMM\n"
31  "Usage: gmm-global-copy [options] <model-in> <model-out>\n"
32  "e.g.: gmm-global-copy --binary=false 1.model - | less";
33 
34  bool binary_write = true;
35  ParseOptions po(usage);
36  po.Register("binary", &binary_write, "Write output in binary mode");
37 
38  po.Read(argc, argv);
39 
40  if (po.NumArgs() != 2) {
41  po.PrintUsage();
42  exit(1);
43  }
44 
45  std::string model_in_filename = po.GetArg(1),
46  model_out_filename = po.GetArg(2);
47 
48  DiagGmm gmm;
49  {
50  bool binary_read;
51  Input ki(model_in_filename, &binary_read);
52  gmm.Read(ki.Stream(), binary_read);
53  }
54  WriteKaldiObject(gmm, model_out_filename, binary_write);
55 
56  KALDI_LOG << "Written model to " << model_out_filename;
57  } catch(const std::exception &e) {
58  std::cerr << e.what() << '\n';
59  return -1;
60  }
61 }
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
Definition: chain.dox:20
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 &in, bool binary)
Definition: diag-gmm.cc:728
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