gmm-info.cc File Reference
Include dependency graph for gmm-info.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 gmm-info.cc.

References AmDiagGmm::Dim(), ParseOptions::GetArg(), TransitionModel::GetPhones(), ParseOptions::NumArgs(), AmDiagGmm::NumGauss(), TransitionModel::NumPdfs(), TransitionModel::NumTransitionIds(), TransitionModel::NumTransitionStates(), ParseOptions::PrintUsage(), AmDiagGmm::Read(), ParseOptions::Read(), TransitionModel::Read(), and Input::Stream().

25  {
26  try {
27  using namespace kaldi;
28  typedef kaldi::int32 int32;
29 
30  const char *usage =
31  "Write to standard output various properties of GMM-based model\n"
32  "Usage: gmm-info [options] <model-in>\n"
33  "e.g.:\n"
34  " gmm-info 1.mdl\n"
35  "See also: gmm-global-info, am-info\n";
36 
37  ParseOptions po(usage);
38 
39  po.Read(argc, argv);
40 
41  if (po.NumArgs() != 1) {
42  po.PrintUsage();
43  exit(1);
44  }
45 
46  std::string model_in_filename = po.GetArg(1);
47 
48  AmDiagGmm am_gmm;
49  TransitionModel trans_model;
50  {
51  bool binary_read;
52  Input ki(model_in_filename, &binary_read);
53  trans_model.Read(ki.Stream(), binary_read);
54  am_gmm.Read(ki.Stream(), binary_read);
55  }
56 
57  std::cout << "number of phones " << trans_model.GetPhones().size() << '\n';
58  std::cout << "number of pdfs " << trans_model.NumPdfs() << '\n';
59  std::cout << "number of transition-ids " << trans_model.NumTransitionIds()
60  << '\n';
61  std::cout << "number of transition-states "
62  << trans_model.NumTransitionStates() << '\n';
63  std::cout << "feature dimension " << am_gmm.Dim() << '\n';
64  std::cout << "number of gaussians " << am_gmm.NumGauss() << '\n';
65  return 0;
66  } catch(const std::exception &e) {
67  std::cerr << e.what() << '\n';
68  return -1;
69  }
70 }
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
Definition: chain.dox:20
int32 NumGauss() const
Definition: am-diag-gmm.cc:72
const std::vector< int32 > & GetPhones() const
Returns a sorted, unique list of phones.
kaldi::int32 int32
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
Definition: parse-options.h:36
int32 NumTransitionIds() const
Returns the total number of transition-ids (note, these are one-based).
void Read(std::istream &is, bool binary)
int32 Dim() const
Definition: am-diag-gmm.h:79
void Read(std::istream &in_stream, bool binary)
Definition: am-diag-gmm.cc:147
int32 NumTransitionStates() const
Returns the total number of transition-states (note, these are one-based).