Skip to content

Commit

Permalink
Use high_freq -400 in computing fbank features. (#294)
Browse files Browse the repository at this point in the history
* Use high_freq -400 in computing fbank features.

See also k2-fsa/sherpa-onnx#514

* Release v2.1.5
  • Loading branch information
csukuangfj authored Jan 4, 2024
1 parent a96bbea commit d615bff
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
project(sherpa-ncnn)

set(SHERPA_NCNN_VERSION "2.1.4")
set(SHERPA_NCNN_VERSION "2.1.5")

# Disable warning about
#
Expand Down
6 changes: 6 additions & 0 deletions sherpa-ncnn/csrc/features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ class FeatureExtractor::Impl {

opts_.mel_opts.num_bins = config.feature_dim;

// Please see
// https://github.com/lhotse-speech/lhotse/blob/master/lhotse/features/fbank.py#L27
// and
// https://github.com/k2-fsa/sherpa-onnx/issues/514
opts_.mel_opts.high_freq = -400;

fbank_ = std::make_unique<knf::OnlineFbank>(opts_);
}

Expand Down
6 changes: 6 additions & 0 deletions sherpa-ncnn/csrc/generate-int8-scale-table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,12 @@ int QuantNet::quantize_KL(const std::vector<std::string> &wave_filenames) {
fbank_opts.frame_opts.samp_freq = expected_sampling_rate;
fbank_opts.mel_opts.num_bins = 80;

// Please see
// https://github.com/lhotse-speech/lhotse/blob/master/lhotse/features/fbank.py#L27
// and
// https://github.com/k2-fsa/sherpa-onnx/issues/514
fbank_opts.mel_opts.high_freq = -400;

int32_t segment = model->Segment();
int32_t offset = model->Offset();

Expand Down

0 comments on commit d615bff

Please sign in to comment.