fgmm-global-info.cc
Go to the documentation of this file.
1 // fgmmbin/fgmm-global-info.cc
2 
3 // Copyright 2012-2013 Johns Hopkins University (Author: Daniel Povey)
4 
5 // See ../../COPYING for clarification regarding multiple authors
6 //
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 // http://www.apache.org/licenses/LICENSE-2.0
12 //
13 // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 // KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
15 // WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
16 // MERCHANTABLITY OR NON-INFRINGEMENT.
17 // See the Apache 2 License for the specific language governing permissions and
18 // limitations under the License.
19 
20 #include "base/kaldi-common.h"
21 #include "util/common-utils.h"
22 #include "gmm/full-gmm.h"
23 #include "hmm/transition-model.h"
24 
25 int main(int argc, char *argv[]) {
26  try {
27  using namespace kaldi;
28  typedef kaldi::int32 int32;
29 
30  const char *usage =
31  "Write to standard output various properties of full-covariance GMM model\n"
32  "This is for a single mixture of Gaussians, e.g. as used for a UBM.\n"
33  "Usage: fgmm-global-info [options] <gmm>\n"
34  "e.g.:\n"
35  " fgmm-global-info 1.ubm\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_rxfilename = po.GetArg(1);
47 
48  FullGmm gmm;
49  ReadKaldiObject(model_rxfilename, &gmm);
50 
51  std::cout << "number of gaussians " << gmm.NumGauss() << '\n';
52  std::cout << "feature dimension " << gmm.Dim() << '\n';
53  return 0;
54  } catch(const std::exception &e) {
55  std::cerr << e.what() << '\n';
56  return -1;
57  }
58 }
59 
60 
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
Definition: chain.dox:20
int32 Dim() const
Returns the dimensionality of the Gaussian mean vectors.
Definition: full-gmm.h:60
Definition for Gaussian Mixture Model with full covariances.
Definition: full-gmm.h:40
void PrintUsage(bool print_command_line=false)
Prints the usage documentation [provided in the constructor].
kaldi::int32 int32
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
int Read(int argc, const char *const *argv)
Parses the command line options and fills the ParseOptions-registered variables.
std::string GetArg(int param) const
Returns one of the positional parameters; 1-based indexing for argc/argv compatibility.
int32 NumGauss() const
Returns the number of mixture components in the GMM.
Definition: full-gmm.h:58
int main(int argc, char *argv[])
int NumArgs() const
Number of positional parameters (c.f. argc-1).