28 using namespace kaldi;
31 "Copy matrices of online-estimated iVectors, but randomize them;\n" 32 "this is intended primarily for training the online nnet2 setup\n" 33 "with iVectors. For each input matrix, each row with index t is,\n" 34 "with probability given by the option --randomize-prob, replaced\n" 35 "with the contents an input row chosen randomly from the interval [t, T]\n" 36 "where T is the index of the last row of the matrix.\n" 38 "Usage: ivector-randomize [options] <ivector-rspecifier> <ivector-wspecifier>\n" 39 " e.g.: ivector-randomize ark:- ark:-\n" 40 "See also: ivector-extract-online, ivector-extract-online2, subsample-feats\n";
47 po.Register(
"srand", &srand_seed,
"Seed for random number generator");
48 po.Register(
"randomize-prob", &randomize_prob,
"For each row, replace it with a " 49 "random row with this probability.");
53 if (po.NumArgs() != 2) {
59 std::string ivector_rspecifier = po.GetArg(1),
60 ivector_wspecifier = po.GetArg(2);
66 for (; !reader.Done(); reader.Next(), num_done++) {
67 std::string utt = reader.Key();
71 for (
int32 t = 0; t < T; t++) {
75 ivectors_out.Row(t).CopyFromVec(ivectors_in.
Row(t_src));
77 writer.Write(utt, ivectors_out);
80 KALDI_LOG <<
"Randomized " << num_done <<
" iVectors.";
81 return (num_done != 0 ? 0 : 1);
82 }
catch(
const std::exception &e) {
83 std::cerr << e.what();
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
MatrixIndexT NumCols() const
Returns number of columns (or zero for empty matrix).
bool WithProb(BaseFloat prob, struct RandomState *state)
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].
A templated class for reading objects sequentially from an archive or script file; see The Table conc...
MatrixIndexT NumRows() const
Returns number of rows (or zero for empty matrix).
int32 RandInt(int32 min_val, int32 max_val, struct RandomState *state)