File tree 3 files changed +21
-1
lines changed
3 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,13 @@ void OnlineIvectorExtractionInfo::Init(
67
67
this ->Check ();
68
68
}
69
69
70
+ int32 OnlineIvectorExtractionInfo::ExpectedFeatureDim () const {
71
+ int32 num_splice = 1 + splice_opts.left_context + splice_opts.right_context ,
72
+ full_dim = diag_ubm.Dim ();
73
+ KALDI_ASSERT (full_dim % num_splice == 0 &&
74
+ " Something went wrong getting the feature dimension" );
75
+ return full_dim / num_splice;
76
+ }
70
77
71
78
void OnlineIvectorExtractionInfo::Check () const {
72
79
KALDI_ASSERT (global_cmvn_stats.NumRows () == 2 );
Original file line number Diff line number Diff line change @@ -193,6 +193,8 @@ struct OnlineIvectorExtractionInfo {
193
193
194
194
void Init (const OnlineIvectorExtractionConfig &config);
195
195
196
+ int32 ExpectedFeatureDim () const ;
197
+
196
198
// This constructor creates a version of this object where everything
197
199
// is empty or zero.
198
200
OnlineIvectorExtractionInfo ();
Original file line number Diff line number Diff line change @@ -94,6 +94,7 @@ int main(int argc, char *argv[]) {
94
94
RandomAccessBaseFloatVectorReader frame_weights_reader (frame_weights_rspecifier);
95
95
BaseFloatMatrixWriter ivector_writer (ivectors_wspecifier);
96
96
97
+ bool warned_dim = false ;
97
98
for (; !spk2utt_reader.Done (); spk2utt_reader.Next ()) {
98
99
std::string spk = spk2utt_reader.Key ();
99
100
const std::vector<std::string> &uttlist = spk2utt_reader.Value ();
@@ -108,7 +109,17 @@ int main(int argc, char *argv[]) {
108
109
}
109
110
const Matrix<BaseFloat> &feats = feature_reader.Value (utt);
110
111
111
- OnlineMatrixFeature matrix_feature (feats);
112
+ int32 feat_dim = feats.NumCols ();
113
+ if (feat_dim == ivector_info.ExpectedFeatureDim () + 3 ) {
114
+ if (!warned_dim) {
115
+ KALDI_WARN << " Feature dimension is too large by 3, assuming there are "
116
+ " pitch features and removing the last 3 dims." ;
117
+ warned_dim = true ;
118
+ }
119
+ feat_dim -= 3 ;
120
+ }
121
+
122
+ OnlineMatrixFeature matrix_feature (feats.ColRange (0 , feat_dim));
112
123
113
124
OnlineIvectorFeature ivector_feature (ivector_info,
114
125
&matrix_feature);
You can’t perform that action at this time.
0 commit comments