Browse Source

Use high_freq -400 in computing fbank features. (#294)

* Use high_freq -400 in computing fbank features.

See also https://github.com/k2-fsa/sherpa-onnx/issues/514

* Release v2.1.5
Fangjun Kuang 1 year ago
parent
commit
d615bff04c
3 changed files with 13 additions and 1 deletions
  1. 1 1
      CMakeLists.txt
  2. 6 0
      sherpa-ncnn/csrc/features.cc
  3. 6 0
      sherpa-ncnn/csrc/generate-int8-scale-table.cc

+ 1 - 1
CMakeLists.txt

@@ -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
 #

+ 6 - 0
sherpa-ncnn/csrc/features.cc

@@ -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_);
   }
 

+ 6 - 0
sherpa-ncnn/csrc/generate-int8-scale-table.cc

@@ -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();