29     using namespace kaldi;
    31         "Precompute Gaussian indices for SGMM training "    32         "Usage: sgmm2-gselect [options] <model-in> <feature-rspecifier> <gselect-wspecifier>\n"    33         "e.g.: sgmm2-gselect 1.sgmm \"ark:feature-command |\" ark:1.gs\n"    34         "Note: you can do the same thing by combining the programs sgmm2-write-ubm, fgmm-global-to-gmm,\n"    35         "gmm-gselect and fgmm-gselect\n";
    39     std::string preselect_rspecifier;
    40     std::string likelihood_wspecifier;
    41     po.
Register(
"write-likes", &likelihood_wspecifier, 
"Wspecifier for likelihoods per "    46     if (po.NumArgs() != 3) {
    51     std::string model_filename = po.GetArg(1),
    52         feature_rspecifier = po.GetArg(2),
    53         gselect_wspecifier = po.GetArg(3);
    55     using namespace kaldi;
    61       Input ki(model_filename, &binary);
    63       trans_model.
Read(ki.Stream(), binary);
    64       am_sgmm.
Read(ki.Stream(), binary);
    67     double tot_like = 0.0;
    68     kaldi::int64 tot_t = 0;
    74     int32 num_done = 0, num_err = 0;
    75     for (; !feature_reader.Done(); feature_reader.Next()) {
    76       int32 tot_t_this_file = 0; 
double tot_like_this_file = 0;
    77       std::string utt = feature_reader.Key();
    79       std::vector<std::vector<int32> > gselect_vec(mat.
NumRows());
    80       tot_t_this_file += mat.
NumRows();
    84       gselect_writer.Write(utt, gselect_vec);
    85       if (num_done % 10 == 0)
    86         KALDI_LOG << 
"For " << num_done << 
"'th file, average UBM likelihood over "    87                   << tot_t_this_file << 
" frames is "    88                   << (tot_like_this_file/tot_t_this_file);
    89       tot_t += tot_t_this_file;
    90       tot_like += tot_like_this_file;
    92       if(likelihood_wspecifier != 
"")
    93         likelihood_writer.Write(utt, tot_like_this_file);
    97     KALDI_LOG << 
"Done " << num_done << 
" files, " << num_err
    98               << 
" with errors, average UBM log-likelihood is "    99               << (tot_like/tot_t) << 
" over " << tot_t << 
" frames.";
   102     if (num_done != 0) 
return 0;
   104   } 
catch(
const std::exception &e) {
   105     std::cerr << e.what();
 This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
 
Class for definition of the subspace Gmm acoustic model. 
 
void Read(std::istream &is, bool binary)
 
A templated class for writing objects to an archive or script file; see The Table concept...
 
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
 
const SubVector< Real > Row(MatrixIndexT i) const
Return specific row of matrix [const]. 
 
void Read(std::istream &is, bool binary)
 
A templated class for reading objects sequentially from an archive or script file; see The Table conc...
 
BaseFloat GaussianSelection(const Sgmm2GselectConfig &config, const VectorBase< BaseFloat > &data, std::vector< int32 > *gselect) const
Computes the top-scoring Gaussian indices (used for pruning of later stages of computation). 
 
MatrixIndexT NumRows() const
Returns number of rows (or zero for empty matrix). 
 
void Register(OptionsItf *opts)