gmm-init-lvtln.cc File Reference
Include dependency graph for gmm-init-lvtln.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 27 of file gmm-init-lvtln.cc.

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

27  {
28  try {
29  using namespace kaldi;
30  using kaldi::int32;
31 
32  const char *usage =
33  "Initialize lvtln transforms\n"
34  "Usage: gmm-init-lvtln [options] <lvtln-out>\n"
35  "e.g.: \n"
36  " gmm-init-lvtln --dim=13 --num-classes=21 --default-class=10 1.lvtln\n";
37 
38  bool binary = true;
39  int32 dim = 13;
40  int32 default_class = 10;
41  int32 num_classes = 21;
42 
43  ParseOptions po(usage);
44  po.Register("binary", &binary, "Write output in binary mode");
45  po.Register("dim", &dim, "feature dimension");
46  po.Register("num-classes", &num_classes, "Number of transforms to be trained");
47  po.Register("default-class", &default_class, "Index of default transform, "
48  "to be used if no data is available for training");
49 
50  po.Read(argc, argv);
51 
52  if (po.NumArgs() != 1) {
53  po.PrintUsage();
54  exit(1);
55  }
56 
57  std::string lvtln_wxfilename = po.GetArg(1);
58 
59  // We'll set the transforms separately using gmm-train-lvtln-special
60  LinearVtln lvtln(dim, num_classes, default_class);
61  WriteKaldiObject(lvtln, lvtln_wxfilename, binary);
62 
63  KALDI_LOG << "Initialized LVTLN object and wrote it to "
64  << PrintableWxfilename(lvtln_wxfilename);
65  return 0;
66  } catch(const std::exception &e) {
67  std::cerr << e.what();
68  return -1;
69  }
70 }
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 WriteKaldiObject(const C &c, const std::string &filename, bool binary)
Definition: kaldi-io.h:257
std::string PrintableWxfilename(const std::string &wxfilename)
PrintableWxfilename turns the wxfilename into a more human-readable form for error reporting...
Definition: kaldi-io.cc:73
#define KALDI_LOG
Definition: kaldi-error.h:153