Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
43a3921
add and delete files
Aug 31, 2018
2bc97b9
add files for TDNN training and modify some files
Sep 13, 2018
d816ad1
modified run.sh and add local/score.sh, get_reslts.sh
Sep 24, 2018
13ce9d0
update and clean up scripts
Oct 2, 2018
53fc524
minor modification
Oct 2, 2018
3a648fc
minor modification
Oct 2, 2018
078137e
Merge branch 'master' into reverb
Szu-JuiChen Oct 3, 2018
2b112e8
parameter update
Oct 3, 2018
04b42f4
Merge branch 'reverb' of https://github.com/Szu-JuiChen/kaldi into re…
Oct 3, 2018
8145d3c
Update run.sh
Szu-JuiChen Oct 3, 2018
37960b2
Update run_tdnn_1a.sh
Szu-JuiChen Oct 3, 2018
cb026a1
Update run_ivector_common.sh
Szu-JuiChen Oct 3, 2018
e775685
fix nan value issue
Oct 4, 2018
6d04afc
Added WPE
sas91 Oct 4, 2018
147cade
Merge pull request #1 from sas91/reverb
Szu-JuiChen Oct 4, 2018
c9e5f6a
Remove partial tag
Oct 6, 2018
327aabb
change naming chime5 to reverb
Oct 9, 2018
623a212
Added Beamformit
sas91 Oct 11, 2018
ccebba1
Updated GMM WPE and Beamformit Results
sas91 Oct 11, 2018
a4b6fb7
Included the beamforming script
sas91 Oct 11, 2018
c9e29fe
Added Beamformit config file
sas91 Oct 11, 2018
1797446
Merge pull request #2 from sas91/reverb
Szu-JuiChen Oct 11, 2018
1c771b7
Store 1ch and 2ch WPE wavefiles in separate directories
sas91 Oct 15, 2018
c2108ce
rm check_tools.sh and bug fixed in run.sh
Oct 15, 2018
d1e5998
remove clean room in recog lists, add wpe only in recog set
sas91 Oct 16, 2018
7b72e54
Merge branch 'reverb' of https://github.com/Szu-JuiChen/kaldi into re…
sas91 Oct 16, 2018
3dc5bb8
added wpe recog sets in run.sh
sas91 Oct 16, 2018
ecda4c1
Added 1ch without WPE also to recog sets
sas91 Oct 16, 2018
d1947df
bug fix for code refactoring in previous commit
sas91 Oct 16, 2018
21f2337
change the data storage place on the grid
Oct 17, 2018
3afa9ed
Merge pull request #3 from sas91/reverb
Szu-JuiChen Oct 19, 2018
31f82f1
Added dereverberation measures, cln evaluation and updated RESULTS
sas91 Nov 7, 2018
3fb2981
Minor modification in scoring script
sas91 Nov 7, 2018
03ffe53
Merge pull request #4 from sas91/reverb
Szu-JuiChen Nov 7, 2018
f453337
Added patch files
sas91 Nov 7, 2018
9c0887d
Merge pull request #5 from sas91/reverb
Szu-JuiChen Nov 8, 2018
53b3259
Updated RESULTS according to Shinji's comments
sas91 Nov 8, 2018
bc0e0f7
Merge pull request #6 from sas91/reverb
Szu-JuiChen Nov 8, 2018
10d4713
Enabled SE computation by default and added flag to enable PESQ
sas91 Nov 15, 2018
7734371
Merge pull request #7 from sas91/reverb
Szu-JuiChen Nov 15, 2018
8d23156
update RESULTS and fix error in compute_se_scores.sh
Nov 18, 2018
5caf1ca
minor fix
Nov 18, 2018
fc0edd5
update RESULTS and fix error in compute_se_scores.sh
Nov 18, 2018
69659e6
remove some useless comment lines
Nov 18, 2018
135494b
1) removed unnecessary files 2) Add the shebang header 3) Add option…
sw005320 Nov 20, 2018
447cdea
delete unused config files
sw005320 Nov 22, 2018
21bdf1e
update reverb README.txt and some chime5 stuff
Nov 29, 2018
da479ce
Merge remote-tracking branch 'vimal/chime5' into reverb
Dec 1, 2018
31ea5d7
add nara_wpe basic version (no batching)
Jan 10, 2019
3023538
Update README.txt
Szu-JuiChen Jan 10, 2019
8b0b56e
Update cmd.sh
Szu-JuiChen Jan 10, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion egs/chime5/s5/cmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
# 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 train_cmd="retry.pl queue.pl --mem 120G"
export decode_cmd="queue.pl --mem 4G"

4 changes: 0 additions & 4 deletions egs/chime5/s5/local/chain/tuning/run_tdnn_1a.sh
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,6 @@ if [ $stage -le 14 ]; then
--trainer.num-chunk-per-minibatch=256,128,64 \
--trainer.optimization.momentum=0.0 \
--egs.chunk-width=$chunk_width \
--egs.chunk-left-context=$chunk_left_context \
--egs.chunk-right-context=$chunk_right_context \
--egs.chunk-left-context-initial=0 \
--egs.chunk-right-context-final=0 \
--egs.dir="$common_egs_dir" \
--egs.opts="--frames-overlap-per-eg 0" \
--cleanup.remove-egs=$remove_egs \
Expand Down
54 changes: 54 additions & 0 deletions egs/chime5/s5/local/run_wpe.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/env python
# Copyright 2018 Johns Hopkins University (Author: Aswin Shanmugam Subramanian)
# Apache 2.0
# Works with both python2 and python3

import numpy as np
import soundfile as sf
import time
import os, errno
from tqdm import tqdm
import argparse

from nara_wpe.wpe import wpe
from nara_wpe.utils import stft, istft
from nara_wpe import project_root

parser = argparse.ArgumentParser()
parser.add_argument('--files', '-f', nargs='+')
args = parser.parse_args()

input_files = args.files[:len(args.files)//2]
output_files = args.files[len(args.files)//2:]
out_dir = os.path.dirname(output_files[0])
try:
os.makedirs(out_dir)
except OSError as e:
if e.errno != errno.EEXIST:
raise

stft_options = dict(
size=512,
shift=128,
window_length=None,
fading=True,
pad=True,
symmetric_window=False
)

sampling_rate = 16000
delay = 3
iterations = 5
taps = 10

signal_list = [
sf.read(f)[0]
for f in input_files
]
y = np.stack(signal_list, axis=0)
Y = stft(y, **stft_options).transpose(2, 0, 1)
Z = wpe(Y, iterations=iterations, statistics_mode='full').transpose(1, 2, 0)
z = istft(Z, size=stft_options['size'], shift=stft_options['shift'])

for d in range(len(signal_list)):
sf.write(output_files[d], z[d,:], sampling_rate)
152 changes: 152 additions & 0 deletions egs/chime5/s5/local/run_wpe.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
#!/bin/bash
# Copyright 2018 Johns Hopkins University (Author: Aswin Shanmugam Subramanian)
# Apache 2.0

. ./cmd.sh
. ./path.sh

# Config:
nj=8
cmd=run.pl

. utils/parse_options.sh || exit 1;

if [ $# != 3 ]; then
echo "Wrong #arguments ($#, expected 3)"
echo "Usage: local/run_wpe.sh [options] <wav-in-dir> <wav-out-dir> <array-id>"
echo "main options (for others, see top of script file)"
echo " --cmd <cmd> # Command to run in parallel with"
echo " --nj 50 # number of jobs for parallel processing"
exit 1;
fi

sdir=$1
odir=$2
array=$3
task=`basename $sdir`
expdir=exp/wpe/${task}_${array}
# Set bash to 'debug' mode, it will exit on :
# -e 'error', -u 'undefined variable', -o ... 'error in pipeline', -x 'print commands',
set -e
set -u
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';"
fi

# check if WPE is installed
result=`$HOME/miniconda3/bin/python -c "\
try:
import nara_wpe
print('1')
except ImportError:
print('0')"`

if [ "$result" == "1" ]; then
echo "WPE is installed"
else
echo "WPE is not installed. Please run ../../../tools/extras/install_wpe.sh"
exit 1
fi

mkdir -p $odir
mkdir -p $expdir/log

# wavfiles.list can be used as the name of the output files
output_wavfiles=$expdir/wavfiles.list
find -L ${sdir} | grep -i ${array} > $expdir/channels_input
cat $expdir/channels_input | awk -F '/' '{print $NF}' | sed "s@S@$odir\/S@g" > $expdir/channels_output
paste -d" " $expdir/channels_input $expdir/channels_output > $output_wavfiles

# split the list for parallel processing
split_wavfiles=""
for n in `seq $nj`; do
split_wavfiles="$split_wavfiles $output_wavfiles.$n"
done
utils/split_scp.pl $output_wavfiles $split_wavfiles || exit 1;

echo -e "Dereverberation - $task - $array\n"
# making a shell script for each job
for n in `seq $nj`; do
cat <<-EOF > $expdir/log/wpe.$n.sh
while read line; do
$HOME/miniconda3/bin/python local/run_wpe.py \
--file \$line
done < $output_wavfiles.$n
EOF
done

chmod a+x $expdir/log/wpe.*.sh
$cmd JOB=1:$nj $expdir/log/wpe.JOB.log \
$expdir/log/wpe.JOB.sh

# #################
# for task in dt et; do
# for nch in 1 2 8; do
# wdir=exp/wpe_${task}_${nch}ch
# mkdir -p $wdir/log
# arrays=$wdir/channels
# output_wavfiles=$wdir/wavfiles.list
# if [ ${nch} == 1 ]; then
# allwavs=`cat ${dir}/${task}_real_1ch_wav.scp | cut -d " " -f2`
# allwavs_output=`cat ${dir}/${task}_real_1ch_wpe_wav.scp | cut -d " " -f2`
# echo $allwavs | tr ' ' '\n' > $wdir/channels_input
# echo $allwavs_output | tr ' ' '\n' > $wdir/channels_output
# paste -d" " $wdir/channels_input $wdir/channels_output > $arrays
# elif [ ${nch} == 2 ]; then
# allwavs=`cat ${dir}/${task}_real_2ch_wav.scp | cut -d " " -f2`
# allwavs_output=`cat ${dir}/${task}_real_2ch_wpe_wav.scp | cut -d " " -f2`
# echo $allwavs | tr ' ' '\n' | rev | sort | rev | awk 'NR%2==1' > $wdir/channels.1st
# echo $allwavs | tr ' ' '\n' | rev | sort | rev | awk 'NR%2==0' > $wdir/channels.2nd
# echo $allwavs_output | tr ' ' '\n' | rev | sort | rev | awk 'NR%2==1' > $wdir/channels_output.1st
# echo $allwavs_output | tr ' ' '\n' | rev | sort | rev | awk 'NR%2==0' > $wdir/channels_output.2nd
# paste -d" " $wdir/channels.1st $wdir/channels.2nd $wdir/channels_output.1st $wdir/channels_output.2nd > $arrays
# elif [ ${nch} == 8 ]; then
# allwavs=`cat ${dir}/${task}_real_8ch_wav.scp | cut -d " " -f2`
# allwavs_output=`cat ${dir}/${task}_real_8ch_wpe_wav.scp | cut -d " " -f2`
# echo $allwavs | tr ' ' '\n' | rev | sort | rev | awk 'NR%8==1' > $wdir/channels.1st
# echo $allwavs | tr ' ' '\n' | rev | sort | rev | awk 'NR%8==2' > $wdir/channels.2nd
# echo $allwavs | tr ' ' '\n' | rev | sort | rev | awk 'NR%8==3' > $wdir/channels.3rd
# echo $allwavs | tr ' ' '\n' | rev | sort | rev | awk 'NR%8==4' > $wdir/channels.4th
# echo $allwavs | tr ' ' '\n' | rev | sort | rev | awk 'NR%8==5' > $wdir/channels.5th
# echo $allwavs | tr ' ' '\n' | rev | sort | rev | awk 'NR%8==6' > $wdir/channels.6th
# echo $allwavs | tr ' ' '\n' | rev | sort | rev | awk 'NR%8==7' > $wdir/channels.7th
# echo $allwavs | tr ' ' '\n' | rev | sort | rev | awk 'NR%8==0' > $wdir/channels.8th
# echo $allwavs_output | tr ' ' '\n' | rev | sort | rev | awk 'NR%8==1' > $wdir/channels_output.1st
# echo $allwavs_output | tr ' ' '\n' | rev | sort | rev | awk 'NR%8==2' > $wdir/channels_output.2nd
# echo $allwavs_output | tr ' ' '\n' | rev | sort | rev | awk 'NR%8==3' > $wdir/channels_output.3rd
# echo $allwavs_output | tr ' ' '\n' | rev | sort | rev | awk 'NR%8==4' > $wdir/channels_output.4th
# echo $allwavs_output | tr ' ' '\n' | rev | sort | rev | awk 'NR%8==5' > $wdir/channels_output.5th
# echo $allwavs_output | tr ' ' '\n' | rev | sort | rev | awk 'NR%8==6' > $wdir/channels_output.6th
# echo $allwavs_output | tr ' ' '\n' | rev | sort | rev | awk 'NR%8==7' > $wdir/channels_output.7th
# echo $allwavs_output | tr ' ' '\n' | rev | sort | rev | awk 'NR%8==0' > $wdir/channels_output.8th
# paste -d" " $wdir/channels.1st $wdir/channels.2nd $wdir/channels.3rd $wdir/channels.4th $wdir/channels.5th $wdir/channels.6th $wdir/channels.7th $wdir/channels.8th $wdir/channels_output.1st $wdir/channels_output.2nd $wdir/channels_output.3rd $wdir/channels_output.4th $wdir/channels_output.5th $wdir/channels_output.6th $wdir/channels_output.7th $wdir/channels_output.8th > $arrays
# fi

# # split the list for parallel processing
# split_wavfiles=""
# for n in `seq $nj`; do
# split_wavfiles="$split_wavfiles $output_wavfiles.$n"
# done
# utils/split_scp.pl $arrays $split_wavfiles || exit 1;

# echo -e "Dereverberation - $task - real - $nch ch\n"
# # making a shell script for each job
# for n in `seq $nj`; do
# cat <<-EOF > $wdir/log/wpe.$n.sh
# while read line; do
# $HOME/miniconda3/bin/python local/run_wpe.py \
# --file \$line
# done < $output_wavfiles.$n
# EOF
# done

# chmod a+x $wdir/log/wpe.*.sh
# $cmd JOB=1:$nj $wdir/log/wpe.JOB.log \
# $wdir/log/wpe.JOB.sh
# done
# done

echo "`basename $0` Done."
53 changes: 44 additions & 9 deletions egs/chime5/s5/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ json_dir=${chime5_corpus}/transcriptions
audio_dir=${chime5_corpus}/audio

# training and test data
train_set=train_worn_u100k
train_set=train_worn_u400k
test_sets="dev_worn dev_${enhancement}_ref eval_${enhancement}_ref"

# This script also needs the phonetisaurus g2p, srilm, beamformit
Expand Down Expand Up @@ -73,18 +73,28 @@ if [ $stage -le 4 ]; then
# Beamforming using reference arrays
# enhanced WAV directory
enhandir=enhan
dereverb_dir=${PWD}/wav/wpe/
for dset in dev eval; do
for mictype in u01 u02 u03 u04 u05 u06; do
local/run_beamformit.sh --cmd "$train_cmd" \
local/run_wpe.sh --cmd "$train_cmd" \
${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 dev 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 All @@ -99,8 +109,8 @@ if [ $stage -le 5 ]; then
# randomly extract first 100k utterances from all mics
# if you want to include more training data, you can increase the number of array mic utterances
utils/combine_data.sh data/train_uall data/train_u01 data/train_u02 data/train_u04 data/train_u05 data/train_u06
utils/subset_data_dir.sh data/train_uall 100000 data/train_u100k
utils/combine_data.sh data/${train_set} data/train_worn data/train_u100k
utils/subset_data_dir.sh data/train_uall 400000 data/train_u400k
utils/combine_data.sh data/${train_set} data/train_worn data/train_u400k

# only use left channel for worn mic recognition
# you can use both left and right channels for training
Expand Down Expand Up @@ -242,15 +252,40 @@ if [ $stage -le 16 ]; then
fi

if [ $stage -le 17 ]; then
# chain TDNN
local/chain/run_tdnn.sh --nj ${nj} --train-set ${train_set}_cleaned --test-sets "$test_sets" --gmm tri3_cleaned --nnet3-affix _${train_set}_cleaned
rm -r data/train_worn_cleaned 2>/dev/null || true
utils/copy_data_dir.sh data/${train_set}_cleaned data/train_worn_cleaned

awk '{print $1}' data/train_worn/wav.scp > data/train_worn_cleaned/recos.tmp
utils/filter_scp.pl data/train_worn_cleaned/recos.tmp \
data/${train_set}_cleaned/wav.scp > data/train_worn_cleaned/wav.scp

utils/fix_data_dir.sh data/train_worn_cleaned

rm -r data/train_u400k_cleaned 2>/dev/null || true
utils/copy_data_dir.sh data/${train_set}_cleaned data/train_u400k_cleaned

utils/filter_scp.pl --exclude data/train_worn_cleaned/recos.tmp \
data/${train_set}_cleaned/wav.scp > data/train_u400k_cleaned/wav.scp

utils/fix_data_dir.sh data/train_u400k_cleaned
fi

if [ $stage -le 18 ]; then
# chain TDNN
#local/chain/tuning/run_tdnn_rvb_1b.sh --nj ${nj} --train-set ${train_set}_cleaned --test-sets "$test_sets" --gmm tri3_cleaned --nnet3-affix _${train_set}_cleaned
local/chain/tuning/run_tdnn_rvb_1b.sh --stage 16 --nj ${nj} \
--train-set-clean train_worn_cleaned \
--train-set-noisy train_u400k_cleaned \
--combined-train-set ${train_set}_cleaned \
--test-sets "$test_sets" \
--gmm tri3_cleaned --nnet3-affix _${train_set}_cleaned_rvb
fi

if [ $stage -le 19 ]; then
# final scoring to get the official challenge result
# 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_${train_set}_cleaned_rvb/tdnn_rvb_1b_sp/decode_dev_${enhancement}_ref \
--eval exp/chain_${train_set}_cleaned_rvb/tdnn_rvb_1b_sp/decode_eval_${enhancement}_ref
fi
Loading