From 5faa4038f7c13a951c3885217ae9537c0f5922af Mon Sep 17 00:00:00 2001 From: Yang Zhou Date: Thu, 21 Apr 2022 21:01:57 +0800 Subject: [PATCH] add recognizer_main_test script --- speechx/examples/ds2_ol/aishell/run.sh | 45 ++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/speechx/examples/ds2_ol/aishell/run.sh b/speechx/examples/ds2_ol/aishell/run.sh index 779123d5..036d277e 100755 --- a/speechx/examples/ds2_ol/aishell/run.sh +++ b/speechx/examples/ds2_ol/aishell/run.sh @@ -5,8 +5,8 @@ set -e . path.sh nj=40 -stage=0 -stop_stage=100 +stage=5 +stop_stage=5 . utils/parse_options.sh @@ -29,8 +29,8 @@ vocb_dir=$ckpt_dir/data/lang_char/ mkdir -p exp exp=$PWD/exp +aishell_wav_scp=aishell_test.scp if [ ${stage} -le 0 ] && [ ${stop_stage} -ge 0 ];then - aishell_wav_scp=aishell_test.scp if [ ! -d $data/test ]; then pushd $data wget -c https://paddlespeech.bj.bcebos.com/s2t/paddle_asr_online/aishell_test.zip @@ -139,3 +139,42 @@ if [ ${stage} -le 4 ] && [ ${stop_stage} -ge 4 ]; then cat $data/split${nj}/*/result_tlg > $exp/${label_file}_tlg utils/compute-wer.py --char=1 --v=1 $text $exp/${label_file}_tlg > $exp/${wer}.tlg fi + +if [ ${stage} -le 5 ] && [ ${stop_stage} -ge 5 ]; then + + cmvn=$data/cmvn.ark + if [ ! -f $data/split${nj}/1/${aishell_wav_scp} ]; then + cmvn-json2kaldi --json_file=$ckpt_dir/data/mean_std.json --cmvn_write_path=$cmvn + ./local/split_data.sh $data ${data}/${aishell_wav_scp} $aishell_wav_scp $nj + fi + + wfst=$data/wfst/ + mkdir -p $wfst + if [ ! -f $wfst/aishell_graph.zip ]; then + pushd $wfst + wget -c https://paddlespeech.bj.bcebos.com/s2t/paddle_asr_online/aishell_graph.zip + unzip aishell_graph.zip + popd + fi + + graph_dir=$wfst/aishell_graph + + # TLG decoder + utils/run.pl JOB=1:$nj $data/split${nj}/JOB/recognizer.log \ + recognizer_test_main \ + --wav_rspecifier=scp:$data/split${nj}/JOB/${aishell_wav_scp} \ + --cmvn_file=$cmvn \ + --model_path=$model_dir/avg_1.jit.pdmodel \ + --convert2PCM32=true \ + --streaming_chunk=30 \ + --params_path=$model_dir/avg_1.jit.pdiparams \ + --word_symbol_table=$graph_dir/words.txt \ + --model_output_names=softmax_0.tmp_0,tmp_5,concat_0.tmp_0,concat_1.tmp_0 \ + --graph_path=$graph_dir/TLG.fst --max_active=7500 \ + --acoustic_scale=1.2 \ + --result_wspecifier=ark,t:$data/split${nj}/JOB/result_recognizer + + cat $data/split${nj}/*/result_recognizer > $exp/${label_file}_recognizer + utils/compute-wer.py --char=1 --v=1 $text $exp/${label_file}_recognizer > $exp/${wer}.recognizer +fi + -- GitLab