62 int main(
int argc, 
char *argv[]) {
    63   using namespace kaldi;
    65   typedef kaldi::int64 int64;
    68         "Accumulate stats for iVector extractor training\n"    69         "Reads in features and Gaussian-level posteriors (typically from a full GMM)\n"    70         "Supports multiple threads, but won't be able to make use of too many at a time\n"    71         "(e.g. more than about 4)\n"    72         "Usage:  ivector-extractor-acc-stats [options] <model-in> <feature-rspecifier>"    73         "<posteriors-rspecifier> <stats-out>\n"    75         " fgmm-global-gselect-to-post 1.fgmm '$feats' 'ark:gunzip -c gselect.1.gz|' ark:- | \\\n"    76         "  ivector-extractor-acc-stats 2.ie '$feats' ark,s,cs:- 2.1.acc\n";
    82     po.
Register(
"binary", &binary, 
"Write output in binary mode");
    93     std::string ivector_extractor_rxfilename = po.
GetArg(1),
    94         feature_rspecifier = po.
GetArg(2),
    95         posteriors_rspecifier = po.
GetArg(3),
    96         accs_wxfilename = po.
GetArg(4);
   119     int32 num_done = 0, num_err = 0;
   124       for (; !feature_reader.
Done(); feature_reader.
Next()) {
   125         std::string key = feature_reader.
Key();
   126         if (!posteriors_reader.
HasKey(key)) {
   127           KALDI_WARN << 
"No posteriors for utterance " << key;
   134         if (static_cast<int32>(posterior.size()) != mat.
NumRows()) {
   135           KALDI_WARN << 
"Size mismatch between posterior " << (posterior.size())
   136                      << 
" and features " << (mat.
NumRows()) << 
" for utterance "   142         sequencer.
Run(
new IvectorTask(extractor, mat, posterior, &stats));
   144         tot_t += posterior.size();
   151     KALDI_LOG << 
"Done " << num_done << 
" files, " << num_err
   152               << 
" with errors.  Total frames " << tot_t;
   155       Output ko(accs_wxfilename, binary);
   159     KALDI_LOG << 
"Wrote stats to " << accs_wxfilename;
   161     return (num_done != 0 ? 0 : 1);
   162   } 
catch(
const std::exception &e) {
   163     std::cerr << e.what();
 
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
 
void Run(C *c)
This function takes ownership of the pointer "c", and will delete it in the same sequence as Run was ...
 
void PrintUsage(bool print_command_line=false)
Prints the usage documentation [provided in the constructor]. 
 
void Register(const std::string &name, bool *ptr, const std::string &doc)
 
void ReadKaldiObject(const std::string &filename, Matrix< float > *m)
 
Allows random access to a collection of objects in an archive or script file; see The Table concept...
 
const IvectorExtractor & extractor_
 
std::vector< std::vector< std::pair< int32, BaseFloat > > > Posterior
Posterior is a typedef for storing acoustic-state (actually, transition-id) posteriors over an uttera...
 
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
 
const T & Value(const std::string &key)
 
A templated class for reading objects sequentially from an archive or script file; see The Table conc...
 
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. 
 
bool HasKey(const std::string &key)
 
int NumArgs() const
Number of positional parameters (c.f. argc-1). 
 
Matrix< BaseFloat > features_
 
MatrixIndexT NumRows() const
Returns number of rows (or zero for empty matrix). 
 
IvectorExtractorStats * stats_
 
IvectorTask(const IvectorExtractor &extractor, const Matrix< BaseFloat > &features, const Posterior &posterior, IvectorExtractorStats *stats)
 
void Register(OptionsItf *opts)