Skip to content

Commit

Permalink
Merge pull request #2 from chimechallenge/chime6pullrequest
Browse files Browse the repository at this point in the history
Chime6 Vimal's pull request
  • Loading branch information
sw005320 authored Nov 18, 2019
2 parents e601fda + 30f3556 commit 687b774
Show file tree
Hide file tree
Showing 44 changed files with 3,780 additions and 37 deletions.
1 change: 1 addition & 0 deletions egs/chime5/s5b/local/nnet3/compare_wer.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,4 @@ done
echo

echo

4 changes: 3 additions & 1 deletion egs/chime5/s5b/local/nnet3/decode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ post_decode_acwt=1.0 # important to change this when using chain models
extra_left_context_initial=0
extra_right_context_final=0

graph_affix=

score_opts="--min-lmwt 6 --max-lmwt 13"

. ./cmd.sh
Expand Down Expand Up @@ -94,7 +96,7 @@ if [ $stage -le 2 ]; then
fi
fi

decode_dir=$dir/decode_${data_set}${affix}
decode_dir=$dir/decode${graph_affix}_${data_set}${affix}
# generate the lattices
if [ $stage -le 3 ]; then
echo "Generating lattices, stage 1"
Expand Down
62 changes: 27 additions & 35 deletions egs/chime5/s5b/local/run_recog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ json_dir=${chime5_corpus}/transcriptions
audio_dir=${chime5_corpus}/audio

# training and test data
train_set=train_worn_u100k
test_sets="eval_${enhancement}_ref"
train_set=train_worn_simu_u400k
test_sets="eval_${enhancement}_dereverb_ref"

# This script also needs the phonetisaurus g2p, srilm, beamformit
./local/check_tools.sh || exit 1
Expand All @@ -38,18 +38,27 @@ if [ $stage -le 4 ]; then
# Beamforming using reference arrays
# enhanced WAV directory
enhandir=enhan
dereverb_dir=${PWD}/wav/wpe/
for dset in eval; do
for mictype in u01 u02 u03 u04 u05 u06; do
local/run_beamformit.sh --cmd "$train_cmd" \
local/run_wpe.sh --nj 4 --cmd "$train_cmd --mem 120G" \
${audio_dir}/${dset} \
${dereverb_dir}/${dset} \
${mictype}
done
done
for dset in dev eval; do
for mictype in u01 u02 u03 u04 u05 u06; do
local/run_beamformit.sh --cmd "$train_cmd" \
${dereverb_dir}/${dset} \
${enhandir}/${dset}_${enhancement}_${mictype} \
${mictype}
done
done

for dset in eval; do
local/prepare_data.sh --mictype ref "$PWD/${enhandir}/${dset}_${enhancement}_u0*" \
${json_dir}/${dset} data/${dset}_${enhancement}_ref
${json_dir}/${dset} data/${dset}_${enhancement}_dereverb_ref
done
fi

Expand Down Expand Up @@ -92,28 +101,13 @@ if [ $stage -le 7 ]; then
done
fi

if [ $stage -le 17 ]; then
nnet3_affix=_${train_set}_cleaned
for datadir in ${test_sets}; do
utils/copy_data_dir.sh data/$datadir data/${datadir}_hires
done
for datadir in ${test_sets}; do
steps/make_mfcc.sh --nj 20 --mfcc-config conf/mfcc_hires.conf \
--cmd "$train_cmd" data/${datadir}_hires || exit 1;
steps/compute_cmvn_stats.sh data/${datadir}_hires || exit 1;
utils/fix_data_dir.sh data/${datadir}_hires || exit 1;
done
for data in $test_sets; do
steps/online/nnet2/extract_ivectors_online.sh --cmd "$train_cmd" --nj 20 \
data/${data}_hires exp/nnet3${nnet3_affix}/extractor \
exp/nnet3${nnet3_affix}/ivectors_${data}_hires
done
fi
nnet3_affix=_${train_set}_cleaned_rvb

lm_suffix=

if [ $stage -le 18 ]; then
# First the options that are passed through to run_ivector_common.sh
# (some of which are also used in this script directly).
lm_suffix=

# The rest are configs specific to this script. Most of the parameters
# are just hardcoded at this level, in the commands below.
Expand All @@ -138,16 +132,14 @@ if [ $stage -le 18 ]; then

for data in $test_sets; do
(
steps/nnet3/decode.sh \
--acwt 1.0 --post-decode-acwt 10.0 \
--extra-left-context $chunk_left_context \
--extra-right-context $chunk_right_context \
--extra-left-context-initial 0 \
--extra-right-context-final 0 \
--frames-per-chunk $frames_per_chunk \
--nj 8 --cmd "$decode_cmd" --num-threads 4 \
--online-ivector-dir exp/nnet3${nnet3_affix}/ivectors_${data}_hires \
$tree_dir/graph${lm_suffix} data/${data}_hires ${dir}/decode${lm_suffix}_${data} || exit 1
local/nnet3/decode.sh --affix 2stage --pass2-decode-opts "--min-active 1000" \
--acwt 1.0 --post-decode-acwt 10.0 \
--frames-per-chunk 150 --nj $decode_nj \
--ivector-dir exp/nnet3${nnet3_affix} \
--graph-affix ${lm_suffix} \
data/${data} data/lang${lm_suffix} \
$tree_dir/graph${lm_suffix} \
exp/chain${nnet3_affix}/tdnn1b_sp
) || touch $dir/.error &
done
wait
Expand All @@ -159,6 +151,6 @@ if [ $stage -le 20 ]; then
# please specify both dev and eval set directories so that the search parameters
# (insertion penalty and language model weight) will be tuned using the dev set
local/score_for_submit.sh \
--dev exp/chain_${train_set}_cleaned/tdnn1a_sp/decode_dev_${enhancement}_ref \
--eval exp/chain_${train_set}_cleaned/tdnn1a_sp/decode_eval_${enhancement}_ref
--dev exp/chain${nnet3_affix}/tdnn1b_sp/decode${lm_suffix}_dev_${enhancement}_dereverb_ref_2stage \
--eval exp/chain${nnet3_affix}/tdnn1b_sp/decode${lm_suffix}_eval_${enhancement}_dereverb_ref_2stage
fi
3 changes: 2 additions & 1 deletion egs/chime5/s5b/local/run_wpe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ set -o pipefail

miniconda_dir=$HOME/miniconda3/
if [ ! -d $miniconda_dir ]; then
echo "$miniconda_dir does not exist. Please run '../../../tools/extras/install_miniconda.sh' and '../../../tools/extras/install_wpe.sh';"
echo "$miniconda_dir does not exist. Please run '$KALDI_ROOT/tools/extras/install_miniconda.sh'."
exit 1
fi

# check if WPE is installed
Expand Down
21 changes: 21 additions & 0 deletions egs/chime6/s5_track1/RESULTS
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

# tri2
%WER 88.52 [ 52121 / 58881, 2023 ins, 30285 del, 19813 sub ] exp/tri2/decode_dev_gss/wer_17_0.5

# tri3
%WER 85.72 [ 50471 / 58881, 3079 ins, 23787 del, 23605 sub ] exp/tri3/decode_dev_gss/wer_17_0.5

# nnet3 tdnn+chain
%WER 41.21 [ 24267 / 58881, 2428 ins, 7606 del, 14233 sub ] exp/chain_train_worn_simu_u400k_cleaned_rvb/tdnn1b_sp/decode_dev_worn_2stage/wer_11_0.0
%WER 62.30 [ 36684 / 58881, 3048 ins, 17964 del, 15672 sub ] exp/chain_train_worn_simu_u400k_cleaned_rvb/tdnn1b_sp/decode_dev_gss_2stage/wer_11_0.0

# result with the challenge submission format (Nov 17, 2019)
# after the fix of speaker ID across arrays
==== development set ====
session S02 room dining: #words 8288, #errors 5106, wer 61.60 %
session S02 room kitchen: #words 12696, #errors 9177, wer 72.28 %
session S02 room living: #words 15460, #errors 8388, wer 54.25 %
session S09 room dining: #words 5766, #errors 3821, wer 66.26 %
session S09 room kitchen: #words 8911, #errors 5594, wer 62.77 %
session S09 room living: #words 7760, #errors 4598, wer 59.25 %
overall: #words 58881, #errors 36684, wer 62.30 %
15 changes: 15 additions & 0 deletions egs/chime6/s5_track1/cmd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# you can change cmd.sh depending on what type of queue you are using.
# If you have no queueing system and want to run on a local machine, you
# can change all instances 'queue.pl' to run.pl (but be careful and run
# commands one by one: most recipes will exhaust the memory on your
# machine). queue.pl works with GridEngine (qsub). slurm.pl works
# with slurm. Different queues are configured differently, with different
# queue names and different ways of specifying things like memory;
# to account for these differences you can create and edit the file
# conf/queue.conf to match your queue's configuration. Search for
# conf/queue.conf in http://kaldi-asr.org/doc/queue.html for more information,
# or search for the string 'default_config' in utils/queue.pl or utils/slurm.pl.

export train_cmd="retry.pl queue.pl --mem 2G"
export decode_cmd="queue.pl --mem 4G"

50 changes: 50 additions & 0 deletions egs/chime6/s5_track1/conf/beamformit.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#BeamformIt sample configuration file for AMI data (http://groups.inf.ed.ac.uk/ami/download/)

# scrolling size to compute the delays
scroll_size = 250

# cross correlation computation window size
window_size = 500

#amount of maximum points for the xcorrelation taken into account
nbest_amount = 4

#flag wether to apply an automatic noise thresholding
do_noise_threshold = 1

#Percentage of frames with lower xcorr taken as noisy
noise_percent = 10

######## acoustic modelling parameters

#transition probabilities weight for multichannel decoding
trans_weight_multi = 25
trans_weight_nbest = 25

###

#flag wether to print the feaures after setting them, or not
print_features = 1

#flag wether to use the bad frames in the sum process
do_avoid_bad_frames = 1

#flag to use the best channel (SNR) as a reference
#defined from command line
do_compute_reference = 1

#flag wether to use a uem file or not(process all the file)
do_use_uem_file = 0

#flag wether to use an adaptative weights scheme or fixed weights
do_adapt_weights = 1

#flag wether to output the sph files or just run the system to create the auxiliary files
do_write_sph_files = 1

####directories where to store/retrieve info####
#channels_file = ./cfg-files/channels

#show needs to be passed as argument normally, here a default one is given just in case
#show_id = Ttmp

2 changes: 2 additions & 0 deletions egs/chime6/s5_track1/conf/mfcc.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--use-energy=false
--sample-frequency=16000
10 changes: 10 additions & 0 deletions egs/chime6/s5_track1/conf/mfcc_hires.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# config for high-resolution MFCC features, intended for neural network training.
# Note: we keep all cepstra, so it has the same info as filterbank features,
# but MFCC is more easily compressible (because less correlated) which is why
# we prefer this method.
--use-energy=false # use average of log energy, not energy.
--sample-frequency=16000
--num-mel-bins=40
--num-ceps=40
--low-freq=40
--high-freq=-400
1 change: 1 addition & 0 deletions egs/chime6/s5_track1/conf/online_cmvn.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# configuration file for apply-cmvn-online, used in the script ../local/run_online_decoding.sh
10 changes: 10 additions & 0 deletions egs/chime6/s5_track1/conf/queue.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
command qsub -v PATH -cwd -S /bin/bash -j y -l arch=*64*
option mem=* -l mem_free=$0,ram_free=$0
option mem=0 # Do not add anything to qsub_opts
option num_threads=* -pe smp $0
option num_threads=1 # Do not add anything to qsub_opts
option max_jobs_run=* -tc $0
default gpu=0
option gpu=0 -q all.q -l hostname='!b19*'
option gpu=* -l gpu=$0 -q g.q -l hostname='!b19*'

131 changes: 131 additions & 0 deletions egs/chime6/s5_track1/local/chain/compare_wer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
#!/bin/bash

# this script is used for comparing decoding results between systems.
# e.g. local/chain/compare_wer.sh exp/chain/tdnn_{c,d}_sp
# For use with discriminatively trained systems you specify the epochs after a colon:
# for instance,
# local/chain/compare_wer.sh exp/chain/tdnn_c_sp exp/chain/tdnn_c_sp_smbr:{1,2,3}


if [ $# == 0 ]; then
echo "Usage: $0: [--looped] [--online] <dir1> [<dir2> ... ]"
echo "e.g.: $0 exp/chain/tdnn_{b,c}_sp"
echo "or (with epoch numbers for discriminative training):"
echo "$0 exp/chain/tdnn_b_sp_disc:{1,2,3}"
exit 1
fi

echo "# $0 $*"

include_looped=false
if [ "$1" == "--looped" ]; then
include_looped=true
shift
fi
include_online=false
if [ "$1" == "--online" ]; then
include_online=true
shift
fi


used_epochs=false

# this function set_names is used to separate the epoch-related parts of the name
# [for discriminative training] and the regular parts of the name.
# If called with a colon-free directory name, like:
# set_names exp/chain/tdnn_lstm1e_sp_bi_smbr
# it will set dir=exp/chain/tdnn_lstm1e_sp_bi_smbr and epoch_infix=""
# If called with something like:
# set_names exp/chain/tdnn_d_sp_smbr:3
# it will set dir=exp/chain/tdnn_d_sp_smbr and epoch_infix="_epoch3"


set_names() {
if [ $# != 1 ]; then
echo "compare_wer_general.sh: internal error"
exit 1 # exit the program
fi
dirname=$(echo $1 | cut -d: -f1)
epoch=$(echo $1 | cut -s -d: -f2)
if [ -z $epoch ]; then
epoch_infix=""
else
used_epochs=true
epoch_infix=_epoch${epoch}
fi
}



echo -n "# System "
for x in $*; do printf "% 10s" " $(basename $x)"; done
echo

strings=(
"#WER dev_clean_2 (tgsmall) "
"#WER dev_clean_2 (tglarge) ")

for n in 0 1; do
echo -n "${strings[$n]}"
for x in $*; do
set_names $x # sets $dirname and $epoch_infix
decode_names=(tgsmall_dev_clean_2 tglarge_dev_clean_2)

wer=$(cat $dirname/decode_${decode_names[$n]}/wer_* | utils/best_wer.sh | awk '{print $2}')
printf "% 10s" $wer
done
echo
if $include_looped; then
echo -n "# [looped:] "
for x in $*; do
set_names $x # sets $dirname and $epoch_infix
wer=$(cat $dirname/decode_looped_${decode_names[$n]}/wer_* | utils/best_wer.sh | awk '{print $2}')
printf "% 10s" $wer
done
echo
fi
if $include_online; then
echo -n "# [online:] "
for x in $*; do
set_names $x # sets $dirname and $epoch_infix
wer=$(cat ${dirname}_online/decode_${decode_names[$n]}/wer_* | utils/best_wer.sh | awk '{print $2}')
printf "% 10s" $wer
done
echo
fi
done


if $used_epochs; then
exit 0; # the diagnostics aren't comparable between regular and discriminatively trained systems.
fi


echo -n "# Final train prob "
for x in $*; do
prob=$(grep Overall $x/log/compute_prob_train.final.log | grep -v xent | awk '{printf("%.4f", $8)}')
printf "% 10s" $prob
done
echo

echo -n "# Final valid prob "
for x in $*; do
prob=$(grep Overall $x/log/compute_prob_valid.final.log | grep -v xent | awk '{printf("%.4f", $8)}')
printf "% 10s" $prob
done
echo

echo -n "# Final train prob (xent)"
for x in $*; do
prob=$(grep Overall $x/log/compute_prob_train.final.log | grep -w xent | awk '{printf("%.4f", $8)}')
printf "% 10s" $prob
done
echo

echo -n "# Final valid prob (xent)"
for x in $*; do
prob=$(grep Overall $x/log/compute_prob_valid.final.log | grep -w xent | awk '{printf("%.4f", $8)}')
printf "% 10s" $prob
done
echo
1 change: 1 addition & 0 deletions egs/chime6/s5_track1/local/chain/run_tdnn.sh
Loading

0 comments on commit 687b774

Please sign in to comment.