27   using namespace kaldi;
    31         "Computes a Plda object (for Probabilistic Linear Discriminant Analysis)\n"    32         "from a set of iVectors.  Uses speaker information from a spk2utt file\n"    33         "to compute within and between class variances.\n"    35         "Usage:  ivector-compute-plda [options] <spk2utt-rspecifier> <ivector-rspecifier> "    38         " ivector-compute-plda ark:spk2utt ark,s,cs:ivectors.ark plda\n";
    47     po.Register(
"binary", &binary, 
"Write output in binary mode");
    51     if (po.NumArgs() != 3) {
    56     std::string spk2utt_rspecifier = po.GetArg(1),
    57         ivector_rspecifier = po.GetArg(2),
    58         plda_wxfilename = po.GetArg(3);
    60     int64 num_spk_done = 0, num_spk_err = 0,
    61         num_utt_done = 0, num_utt_err = 0;
    68     for (; !spk2utt_reader.Done(); spk2utt_reader.Next()) {
    69       std::string spk = spk2utt_reader.Key();
    70       const std::vector<std::string> &uttlist = spk2utt_reader.Value();
    71       if (uttlist.empty()) {
    72         KALDI_ERR << 
"Speaker with no utterances.";
    74       std::vector<Vector<BaseFloat> > ivectors;
    75       ivectors.reserve(uttlist.size());
    77       for (
size_t i = 0; 
i < uttlist.size(); 
i++) {
    78         std::string utt = uttlist[
i];
    79         if (!ivector_reader.HasKey(utt)) {
    80           KALDI_WARN << 
"No iVector present in input for utterance " << utt;
    83           ivectors.resize(ivectors.size() + 1);
    84           ivectors.back() = ivector_reader.Value(utt);
    89       if (ivectors.size() == 0) {
    90         KALDI_WARN << 
"Not producing output for speaker " << spk
    91                    << 
" since no utterances had iVectors";
    95         for (
size_t i = 0; 
i < ivectors.size(); 
i++)
    96           ivector_mat.
Row(
i).CopyFromVec(ivectors[
i]);
   105     if (num_utt_done <= plda_stats.
Dim())
   106       KALDI_ERR << 
"Number of training iVectors is not greater than their "   107                 << 
"dimension, unable to estimate PLDA.";
   109     KALDI_LOG << 
"Accumulated stats from " << num_spk_done << 
" speakers ("   110               << num_spk_err << 
" with no utterances), consisting of "   111               << num_utt_done << 
" utterances (" << num_utt_err
   112               << 
" absent from input).";
   114     if (num_spk_done == 0)
   115       KALDI_ERR << 
"No stats accumulated, unable to estimate PLDA.";
   116     if (num_spk_done == num_utt_done)
   117       KALDI_ERR << 
"No speakers with multiple utterances, "   118                 << 
"unable to estimate PLDA.";
   123     plda_estimator.Estimate(plda_config, &plda);
   127     return (num_spk_done != 0 ? 0 : 1);
   128   } 
catch(
const std::exception &e) {
   129     std::cerr << e.what();
 This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
 
Allows random access to a collection of objects in 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]. 
 
A templated class for reading objects sequentially from an archive or script file; see The Table conc...
 
void AddSamples(double weight, const Matrix< double > &group)
The dimension is set up the first time you add samples. 
 
void WriteKaldiObject(const C &c, const std::string &filename, bool binary)
 
void Register(OptionsItf *opts)