Skip to content

Commit

Permalink
Use high_freq -400 in computing fbank features. (#528)
Browse files Browse the repository at this point in the history
  • Loading branch information
csukuangfj authored Jan 4, 2024
1 parent 30ed540 commit 62f9697
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sherpa/bin/offline_ctc_asr.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ def create_recognizer(args):

feat_config.fbank_opts.frame_opts.samp_freq = 16000
feat_config.fbank_opts.mel_opts.num_bins = 80
feat_config.fbank_opts.mel_opts.high_freq = -400
feat_config.fbank_opts.frame_opts.dither = 0

feat_config.normalize_samples = args.normalize_samples
Expand Down Expand Up @@ -377,7 +378,9 @@ def main():

if __name__ == "__main__":
torch.manual_seed(20230104)
formatter = "%(asctime)s %(levelname)s [%(filename)s:%(lineno)d] %(message)s" # noqa
formatter = (
"%(asctime)s %(levelname)s [%(filename)s:%(lineno)d] %(message)s" # noqa
)
logging.basicConfig(format=formatter, level=logging.INFO)

main()
1 change: 1 addition & 0 deletions sherpa/bin/offline_ctc_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ def create_recognizer(args) -> sherpa.OfflineRecognizer:

feat_config.fbank_opts.frame_opts.samp_freq = args.sample_rate
feat_config.fbank_opts.mel_opts.num_bins = args.feat_dim
feat_config.fbank_opts.mel_opts.high_freq = -400
feat_config.fbank_opts.frame_opts.dither = 0

feat_config.normalize_samples = args.normalize_samples
Expand Down
1 change: 1 addition & 0 deletions sherpa/bin/offline_transducer_asr.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ def create_recognizer(args) -> sherpa.OfflineRecognizer:

feat_config.fbank_opts.frame_opts.samp_freq = args.sample_rate
feat_config.fbank_opts.mel_opts.num_bins = args.feat_dim
feat_config.fbank_opts.mel_opts.high_freq = -400
feat_config.fbank_opts.frame_opts.dither = 0

fast_beam_search_config = sherpa.FastBeamSearchConfig(
Expand Down
1 change: 1 addition & 0 deletions sherpa/bin/offline_transducer_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,7 @@ def create_recognizer(args) -> sherpa.OfflineRecognizer:

feat_config.fbank_opts.frame_opts.samp_freq = args.sample_rate
feat_config.fbank_opts.mel_opts.num_bins = args.feat_dim
feat_config.fbank_opts.mel_opts.high_freq = -400
feat_config.fbank_opts.frame_opts.dither = 0

fast_beam_search_config = sherpa.FastBeamSearchConfig(
Expand Down
1 change: 1 addition & 0 deletions sherpa/bin/online_transducer_asr.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ def create_recognizer(args) -> sherpa.OnlineRecognizer:

feat_config.fbank_opts.frame_opts.samp_freq = args.sample_rate
feat_config.fbank_opts.mel_opts.num_bins = args.feat_dim
feat_config.fbank_opts.mel_opts.high_freq = -400
feat_config.fbank_opts.frame_opts.dither = 0

fast_beam_search_config = sherpa.FastBeamSearchConfig(
Expand Down
1 change: 1 addition & 0 deletions sherpa/bin/streaming_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ def create_recognizer(args) -> sherpa.OnlineRecognizer:

feat_config.fbank_opts.frame_opts.samp_freq = args.sample_rate
feat_config.fbank_opts.mel_opts.num_bins = args.feat_dim
feat_config.fbank_opts.mel_opts.high_freq = -400
feat_config.fbank_opts.frame_opts.dither = 0

fast_beam_search_config = sherpa.FastBeamSearchConfig(
Expand Down
6 changes: 6 additions & 0 deletions sherpa/python/test/test_offline_recognizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def test_icefall_ctc_model(self):

feat_config.fbank_opts.frame_opts.samp_freq = 16000
feat_config.fbank_opts.mel_opts.num_bins = 80
feat_config.fbank_opts.mel_opts.high_freq = -400
feat_config.fbank_opts.frame_opts.dither = 0

config = sherpa.OfflineRecognizerConfig(
Expand Down Expand Up @@ -72,6 +73,7 @@ def test_icefall_ctc_model_hlg_decoding(self):

feat_config.fbank_opts.frame_opts.samp_freq = 16000
feat_config.fbank_opts.mel_opts.num_bins = 80
feat_config.fbank_opts.mel_opts.high_freq = -400
feat_config.fbank_opts.frame_opts.dither = 0

ctc_decoder_config = sherpa.OfflineCtcDecoderConfig(hlg=hlg)
Expand Down Expand Up @@ -112,6 +114,7 @@ def test_wenet_ctc_model(self):

feat_config.fbank_opts.frame_opts.samp_freq = 16000
feat_config.fbank_opts.mel_opts.num_bins = 80
feat_config.fbank_opts.mel_opts.high_freq = -400
feat_config.fbank_opts.frame_opts.dither = 0

config = sherpa.OfflineRecognizerConfig(
Expand Down Expand Up @@ -185,6 +188,7 @@ def test_nemo_ctc_en_model(self):

feat_config.fbank_opts.frame_opts.samp_freq = 16000
feat_config.fbank_opts.mel_opts.num_bins = 80
feat_config.fbank_opts.mel_opts.high_freq = -400
feat_config.fbank_opts.frame_opts.dither = 0

# The following option is very important.
Expand Down Expand Up @@ -236,6 +240,7 @@ def test_nemo_ctc_zh_model(self):

feat_config.fbank_opts.frame_opts.samp_freq = 16000
feat_config.fbank_opts.mel_opts.num_bins = 80
feat_config.fbank_opts.mel_opts.high_freq = -400
feat_config.fbank_opts.frame_opts.dither = 0

# The following option is very important.
Expand Down Expand Up @@ -288,6 +293,7 @@ def test_icefall_transducer_model(self):

feat_config.fbank_opts.frame_opts.samp_freq = 16000
feat_config.fbank_opts.mel_opts.num_bins = 80
feat_config.fbank_opts.mel_opts.high_freq = -400
feat_config.fbank_opts.frame_opts.dither = 0

config = sherpa.OfflineRecognizerConfig(
Expand Down
8 changes: 8 additions & 0 deletions sherpa/python/test/test_online_recognizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def test_icefall_asr_librispeech_conv_emformer_transducer_stateless2_2022_07_05(

feat_config.fbank_opts.frame_opts.samp_freq = expected_sample_rate
feat_config.fbank_opts.mel_opts.num_bins = 80
feat_config.fbank_opts.mel_opts.high_freq = -400
feat_config.fbank_opts.frame_opts.dither = 0

print("--------------------greedy search--------------------")
Expand Down Expand Up @@ -190,6 +191,7 @@ def test_icefall_asr_wenetspeech_pruned_transducer_stateless5_streaming(

feat_config.fbank_opts.frame_opts.samp_freq = expected_sample_rate
feat_config.fbank_opts.mel_opts.num_bins = 80
feat_config.fbank_opts.mel_opts.high_freq = -400
feat_config.fbank_opts.frame_opts.dither = 0

print("--------------------greedy search--------------------")
Expand Down Expand Up @@ -316,6 +318,7 @@ def test_icefall_asr_conv_emformer_transducer_stateless2_zh(

feat_config.fbank_opts.frame_opts.samp_freq = expected_sample_rate
feat_config.fbank_opts.mel_opts.num_bins = 80
feat_config.fbank_opts.mel_opts.high_freq = -400
feat_config.fbank_opts.frame_opts.dither = 0

print("--------------------greedy search--------------------")
Expand Down Expand Up @@ -398,6 +401,7 @@ def test_icefall_librispeech_streaming_pruned_transducer_stateless4_20220625(

feat_config.fbank_opts.frame_opts.samp_freq = expected_sample_rate
feat_config.fbank_opts.mel_opts.num_bins = 80
feat_config.fbank_opts.mel_opts.high_freq = -400
feat_config.fbank_opts.frame_opts.dither = 0

print("--------------------greedy search--------------------")
Expand Down Expand Up @@ -521,6 +525,7 @@ def test_cefall_asr_librispeech_lstm_transducer_stateless2_2022_09_03(

feat_config.fbank_opts.frame_opts.samp_freq = expected_sample_rate
feat_config.fbank_opts.mel_opts.num_bins = 80
feat_config.fbank_opts.mel_opts.high_freq = -400
feat_config.fbank_opts.frame_opts.dither = 0

print("--------------------greedy search--------------------")
Expand Down Expand Up @@ -641,6 +646,7 @@ def test_icefall_asr_librispeech_pruned_stateless_emformer_rnnt2_2022_06_01(

feat_config.fbank_opts.frame_opts.samp_freq = expected_sample_rate
feat_config.fbank_opts.mel_opts.num_bins = 80
feat_config.fbank_opts.mel_opts.high_freq = -400
feat_config.fbank_opts.frame_opts.dither = 0

print("--------------------greedy search--------------------")
Expand Down Expand Up @@ -744,6 +750,7 @@ def test_k2fsa_zipformer_chinese_english_mixed(self):

feat_config.fbank_opts.frame_opts.samp_freq = expected_sample_rate
feat_config.fbank_opts.mel_opts.num_bins = 80
feat_config.fbank_opts.mel_opts.high_freq = -400
feat_config.fbank_opts.frame_opts.dither = 0

print("--------------------greedy search--------------------")
Expand Down Expand Up @@ -829,6 +836,7 @@ def test_icefall_asr_librispeech_pruned_transducer_stateless7_streaming_2022_12_

feat_config.fbank_opts.frame_opts.samp_freq = expected_sample_rate
feat_config.fbank_opts.mel_opts.num_bins = 80
feat_config.fbank_opts.mel_opts.high_freq = -400
feat_config.fbank_opts.frame_opts.dither = 0

print("--------------------greedy search--------------------")
Expand Down

0 comments on commit 62f9697

Please sign in to comment.