Skip to content

Commit

Permalink
Revert "[src] Making ivector extractor tolerate dim mismatch due to p…
Browse files Browse the repository at this point in the history
…itch (kaldi-asr#3727)" (kaldi-asr#3728)

This reverts commit 59255ae.
  • Loading branch information
danpovey committed Nov 21, 2019
1 parent 59255ae commit eb28a6a
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 21 deletions.
7 changes: 0 additions & 7 deletions src/online2/online-ivector-feature.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,6 @@ void OnlineIvectorExtractionInfo::Init(
this->Check();
}

int32 OnlineIvectorExtractionInfo::ExpectedFeatureDim() const {
int32 num_splice = 1 + splice_opts.left_context + splice_opts.right_context,
full_dim = diag_ubm.Dim();
KALDI_ASSERT(full_dim % num_splice == 0 &&
"Something went wrong getting the feature dimension");
return full_dim / num_splice;
}

void OnlineIvectorExtractionInfo::Check() const {
KALDI_ASSERT(global_cmvn_stats.NumRows() == 2);
Expand Down
2 changes: 0 additions & 2 deletions src/online2/online-ivector-feature.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,6 @@ struct OnlineIvectorExtractionInfo {

void Init(const OnlineIvectorExtractionConfig &config);

int32 ExpectedFeatureDim() const;

// This constructor creates a version of this object where everything
// is empty or zero.
OnlineIvectorExtractionInfo();
Expand Down
13 changes: 1 addition & 12 deletions src/online2bin/ivector-extract-online2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ int main(int argc, char *argv[]) {
RandomAccessBaseFloatVectorReader frame_weights_reader(frame_weights_rspecifier);
BaseFloatMatrixWriter ivector_writer(ivectors_wspecifier);

bool warned_dim = false;
for (; !spk2utt_reader.Done(); spk2utt_reader.Next()) {
std::string spk = spk2utt_reader.Key();
const std::vector<std::string> &uttlist = spk2utt_reader.Value();
Expand All @@ -109,17 +108,7 @@ int main(int argc, char *argv[]) {
}
const Matrix<BaseFloat> &feats = feature_reader.Value(utt);

int32 feat_dim = feats.NumCols();
if (feat_dim == ivector_info.ExpectedFeatureDim() + 3) {
if (!warned_dim) {
KALDI_WARN << "Feature dimension is too large by 3, assuming there are "
"pitch features and removing the last 3 dims.";
warned_dim = true;
}
feat_dim -= 3;
}

OnlineMatrixFeature matrix_feature(feats.ColRange(0, feat_dim));
OnlineMatrixFeature matrix_feature(feats);

OnlineIvectorFeature ivector_feature(ivector_info,
&matrix_feature);
Expand Down

0 comments on commit eb28a6a

Please sign in to comment.