Blame view
egs/reverb/s5/local/run_wpe.sh
8.94 KB
8dcb6dfcb first commit |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
#!/bin/bash # Copyright 2018 Johns Hopkins University (Author: Aswin Shanmugam Subramanian) # Apache 2.0 . ./cmd.sh . ./path.sh # Config: nj=50 cmd=run.pl . utils/parse_options.sh || exit 1; # 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" fi dir=${PWD}/data/local/data for task in dt et; do for nch in 1 2 8; do wdir=exp/wpe_real_${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 ' ' ' ' > $wdir/channels_input echo $allwavs_output | tr ' ' ' ' > $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 ' ' ' ' | rev | sort | rev | awk 'NR%2==1' > $wdir/channels.1st echo $allwavs | tr ' ' ' ' | rev | sort | rev | awk 'NR%2==0' > $wdir/channels.2nd echo $allwavs_output | tr ' ' ' ' | rev | sort | rev | awk 'NR%2==1' > $wdir/channels_output.1st echo $allwavs_output | tr ' ' ' ' | 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 ' ' ' ' | rev | sort | rev | awk 'NR%8==1' > $wdir/channels.1st echo $allwavs | tr ' ' ' ' | rev | sort | rev | awk 'NR%8==2' > $wdir/channels.2nd echo $allwavs | tr ' ' ' ' | rev | sort | rev | awk 'NR%8==3' > $wdir/channels.3rd echo $allwavs | tr ' ' ' ' | rev | sort | rev | awk 'NR%8==4' > $wdir/channels.4th echo $allwavs | tr ' ' ' ' | rev | sort | rev | awk 'NR%8==5' > $wdir/channels.5th echo $allwavs | tr ' ' ' ' | rev | sort | rev | awk 'NR%8==6' > $wdir/channels.6th echo $allwavs | tr ' ' ' ' | rev | sort | rev | awk 'NR%8==7' > $wdir/channels.7th echo $allwavs | tr ' ' ' ' | rev | sort | rev | awk 'NR%8==0' > $wdir/channels.8th echo $allwavs_output | tr ' ' ' ' | rev | sort | rev | awk 'NR%8==1' > $wdir/channels_output.1st echo $allwavs_output | tr ' ' ' ' | rev | sort | rev | awk 'NR%8==2' > $wdir/channels_output.2nd echo $allwavs_output | tr ' ' ' ' | rev | sort | rev | awk 'NR%8==3' > $wdir/channels_output.3rd echo $allwavs_output | tr ' ' ' ' | rev | sort | rev | awk 'NR%8==4' > $wdir/channels_output.4th echo $allwavs_output | tr ' ' ' ' | rev | sort | rev | awk 'NR%8==5' > $wdir/channels_output.5th echo $allwavs_output | tr ' ' ' ' | rev | sort | rev | awk 'NR%8==6' > $wdir/channels_output.6th echo $allwavs_output | tr ' ' ' ' | rev | sort | rev | awk 'NR%8==7' > $wdir/channels_output.7th echo $allwavs_output | tr ' ' ' ' | 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 " # 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 for task in dt et; do for nch in 1 2 8; do wdir=exp/wpe_simu_${task}_${nch}ch mkdir -p $wdir/log arrays=$wdir/channels output_wavfiles=$wdir/wavfiles.list if [ ${nch} == 1 ]; then allwavs=`cat ${dir}/${task}_simu_1ch_wav.scp | cut -d " " -f2` allwavs_output=`cat ${dir}/${task}_simu_1ch_wpe_wav.scp | cut -d " " -f2` echo $allwavs | tr ' ' ' ' > $wdir/channels_input echo $allwavs_output | tr ' ' ' ' > $wdir/channels_output paste -d" " $wdir/channels_input $wdir/channels_output > $arrays elif [ ${nch} == 2 ]; then allwavs=`cat ${dir}/${task}_simu_2ch_wav.scp | cut -d " " -f2` allwavs_output=`cat ${dir}/${task}_simu_2ch_wpe_wav.scp | cut -d " " -f2` echo $allwavs | tr ' ' ' ' | grep 'ch1' | sort > $wdir/channels.1st echo $allwavs | tr ' ' ' ' | grep 'ch2' | sort > $wdir/channels.2nd echo $allwavs_output | tr ' ' ' ' | grep 'ch1' | sort > $wdir/channels_output.1st echo $allwavs_output | tr ' ' ' ' | grep 'ch2' | sort > $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}_simu_8ch_wav.scp | cut -d " " -f2` allwavs_output=`cat ${dir}/${task}_simu_8ch_wpe_wav.scp | cut -d " " -f2` echo $allwavs | tr ' ' ' ' | grep 'ch1' | sort > $wdir/channels.1st echo $allwavs | tr ' ' ' ' | grep 'ch2' | sort > $wdir/channels.2nd echo $allwavs | tr ' ' ' ' | grep 'ch3' | sort > $wdir/channels.3rd echo $allwavs | tr ' ' ' ' | grep 'ch4' | sort > $wdir/channels.4th echo $allwavs | tr ' ' ' ' | grep 'ch5' | sort > $wdir/channels.5th echo $allwavs | tr ' ' ' ' | grep 'ch6' | sort > $wdir/channels.6th echo $allwavs | tr ' ' ' ' | grep 'ch7' | sort > $wdir/channels.7th echo $allwavs | tr ' ' ' ' | grep 'ch8' | sort > $wdir/channels.8th echo $allwavs_output | tr ' ' ' ' | grep 'ch1' | sort > $wdir/channels_output.1st echo $allwavs_output | tr ' ' ' ' | grep 'ch2' | sort > $wdir/channels_output.2nd echo $allwavs_output | tr ' ' ' ' | grep 'ch3' | sort > $wdir/channels_output.3rd echo $allwavs_output | tr ' ' ' ' | grep 'ch4' | sort > $wdir/channels_output.4th echo $allwavs_output | tr ' ' ' ' | grep 'ch5' | sort > $wdir/channels_output.5th echo $allwavs_output | tr ' ' ' ' | grep 'ch6' | sort > $wdir/channels_output.6th echo $allwavs_output | tr ' ' ' ' | grep 'ch7' | sort > $wdir/channels_output.7th echo $allwavs_output | tr ' ' ' ' | grep 'ch8' | sort > $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 - simu - $nch ch " # 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." |