tomwalters@54
|
1 #!/bin/bash
|
tomwalters@54
|
2 # Copyright 2010 Thomas Walters <tom@acousticscale.org>
|
tomwalters@54
|
3 #
|
tomwalters@54
|
4 # Run a series of experiments which compare MFCC features generated by HTK to
|
tomwalters@54
|
5 # AIM features generated using AIM-C using a series of syllable recogntiton
|
tomwalters@54
|
6 # tasks.
|
tomwalters@165
|
7 # This script expects the HTK binaries and AIM-C AIMCopy binary to be present
|
tomwalters@165
|
8 # in the PATH.
|
tomwalters@128
|
9
|
tomwalters@54
|
10 # Set these to be the location of your input database, and desired output
|
tomwalters@165
|
11 # locations.
|
tomwalters@178
|
12 SYLLABLES_DATABASE_TAR=/mnt/sounds/cnbh-syllables.tar
|
tomwalters@165
|
13 SOUNDS_ROOT=/mnt/experiments/sounds/
|
tomwalters@165
|
14 FEATURES_ROOT=/mnt/experiments/features/
|
tomwalters@165
|
15 HMMS_ROOT=/mnt/experiments/hmms/
|
tomwalters@128
|
16
|
tomwalters@54
|
17 # Number of cores on the experimental machine. Various scripts will try to use
|
tomwalters@54
|
18 # this if it's set.
|
tomwalters@184
|
19 NUMBER_OF_CORES=1
|
tomwalters@54
|
20
|
tomwalters@54
|
21 # Fail if any command fails
|
tomwalters@54
|
22 set -e
|
tomwalters@54
|
23
|
tomwalters@54
|
24 # Fail if any variable is unset
|
tomwalters@54
|
25 set -u
|
tomwalters@54
|
26
|
tomwalters@178
|
27 if [ ! -e $SYLLABLES_DATABASE_TAR ]; then
|
tomwalters@178
|
28 sudo mkdir -p `dirname $SYLLABLES_DATABASE_TAR`
|
tomwalters@178
|
29 sudo chown ubuntu `dirname $SYLLABLES_DATABASE_TAR`
|
tomwalters@178
|
30 wget -O $SYLLABLES_DATABASE_TAR $SYLLABLES_DATABASE_URL
|
tomwalters@178
|
31 fi
|
tomwalters@178
|
32
|
tomwalters@54
|
33 if [ ! -d $SOUNDS_ROOT ]; then
|
tomwalters@169
|
34 sudo mkdir -p $SOUNDS_ROOT
|
tomwalters@169
|
35 sudo chown `whoami` $SOUNDS_ROOT
|
tomwalters@54
|
36 fi
|
tomwalters@54
|
37
|
tomwalters@165
|
38 # Untar the CNBH syllables database, and convert the files from FLAC to WAV
|
tomwalters@54
|
39 if [ ! -e $SOUNDS_ROOT/.untar_db_success ]; then
|
tomwalters@54
|
40 tar -x -C $SOUNDS_ROOT -f $SYLLABLES_DATABASE_TAR
|
tomwalters@54
|
41 touch $SOUNDS_ROOT/.untar_db_success
|
tomwalters@54
|
42 fi
|
tomwalters@54
|
43
|
tomwalters@54
|
44 # Convert the database to .WAV format and place it in $SOUNDS_ROOT/clean
|
tomwalters@185
|
45 echo "Converting CNBH-syllables database from FLAC to WAV..."
|
tomwalters@171
|
46 ./cnbh-syllables/feature_generation/convert_flac_to_wav.sh $SOUNDS_ROOT
|
tomwalters@54
|
47
|
tomwalters@54
|
48 # Generate versions of the CNBH syllables spoke pattern with a range of
|
tomwalters@54
|
49 # signal-to-noise ratios (SNRs). The versions are put in the directory
|
tomwalters@54
|
50 # ${SOUNDS_ROOT}/${SNR}_dB/ for each SNR in $SNRS.
|
tomwalters@165
|
51 SNRS="30 27 24 21 18 15 12 9 6 3 0"
|
tomwalters@186
|
52 ./cnbh-syllables/feature_generation/pink_noise.sh $SOUNDS_ROOT/clean/ "$SNRS"
|
tomwalters@54
|
53
|
tomwalters@54
|
54 # Make the list of all feature drectories
|
tomwalters@165
|
55 FEATURE_DIRS="clean"
|
tomwalters@54
|
56 for SNR in $SNRS; do
|
tomwalters@54
|
57 FEATURE_DIRS="$FEATURE_DIRS snr_${SNR}dB"
|
tomwalters@54
|
58 done
|
tomwalters@54
|
59
|
tomwalters@54
|
60 # Generate feature sets (for the full range of SNRs in $FEATURE_DIRS)
|
tomwalters@54
|
61 # 1. Standard MFCC features
|
tomwalters@54
|
62 # 2. AIM features
|
tomwalters@165
|
63 # 3. MFCC features with optimal VTLN
|
tomwalters@169
|
64
|
tomwalters@169
|
65
|
tomwalters@169
|
66 if [ ! -d $FEATURES_ROOT ]; then
|
tomwalters@169
|
67 sudo mkdir -p $FEATURES_ROOT
|
tomwalters@169
|
68 sudo chown `whoami` $FEATURES_ROOT
|
tomwalters@169
|
69 fi
|
tomwalters@169
|
70
|
tomwalters@180
|
71 if [ ! -e /mnt/experiments/htk/.htk_installed_success ]; then
|
tomwalters@180
|
72 ./HTK/install_htk.sh
|
tomwalters@181
|
73 fi
|
tomwalters@180
|
74
|
tomwalters@184
|
75 if [ ! -e /mnt/experiments/aimc/.aimc_build_success ]; then
|
tomwalters@183
|
76 # ./aimc/build_aimc.sh
|
tomwalters@183
|
77 cd ../../
|
tomwalters@183
|
78 scons
|
tomwalters@183
|
79 export PATH=$PATH:`pwd`/build/posix-release/
|
tomwalters@183
|
80 cd -
|
tomwalters@183
|
81 fi
|
tomwalters@183
|
82
|
tomwalters@54
|
83 for SOURCE_SNR in $FEATURE_DIRS; do
|
tomwalters@165
|
84
|
tomwalters@177
|
85 if [ ! -e $FEATURES_ROOT/mfcc/$SOURCE_SNR/.make_mfcc_features_success ]; then
|
tomwalters@54
|
86 mkdir -p $FEATURES_ROOT/mfcc/$SOURCE_SNR/
|
tomwalters@54
|
87 # Generate the list of files to convert
|
tomwalters@165
|
88 ./cnbh-syllables/feature_generation/gen_hcopy_aimcopy_script.sh $FEATURES_ROOT/mfcc/$SOURCE_SNR/ $SOUNDS_ROOT/$SOURCE_SNR/
|
tomwalters@54
|
89 # Run the conversion
|
tomwalters@101
|
90 ./cnbh-syllables/feature_generation/run_hcopy.sh $FEATURES_ROOT/mfcc/$SOURCE_SNR/ $NUMBER_OF_CORES
|
tomwalters@101
|
91 touch $FEATURES_ROOT/mfcc/$SOURCE_SNR/.make_mfcc_features_success
|
tomwalters@176
|
92 fi
|
tomwalters@54
|
93
|
tomwalters@177
|
94 if [ ! -e $FEATURES_ROOT/mfcc_vtln/$SOURCE_SNR/.make_mfcc_vtln_features_success ]; then
|
tomwalters@54
|
95 mkdir -p $FEATURES_ROOT/mfcc_vtln/$SOURCE_SNR/
|
tomwalters@54
|
96 # Generate the file list and run the conversion (all one step, since this
|
tomwalters@186
|
97 # version uses a different configuration for each talker)
|
tomwalters@101
|
98 ./cnbh-syllables/feature_generation/run_mfcc_vtln_conversion.sh $FEATURES_ROOT/mfcc_vtln/$SOURCE_SNR/ $SOUNDS_ROOT/$SOURCE_SNR/
|
tomwalters@101
|
99 touch $FEATURES_ROOT/mfcc_vtln/$SOURCE_SNR/.make_mfcc_vtln_features_success
|
tomwalters@176
|
100 fi
|
tomwalters@54
|
101
|
tomwalters@177
|
102 if [ ! -e $FEATURES_ROOT/aim/$SOURCE_SNR/.make_aim_features_success ]; then
|
tomwalters@165
|
103 mkdir -p $FEATURES_ROOT/aim/$SOURCE_SNR/
|
tomwalters@165
|
104 ./cnbh-syllables/feature_generation/gen_hcopy_aimcopy_script.sh $FEATURES_ROOT/aim/$SOURCE_SNR/ $SOUNDS_ROOT/$SOURCE_SNR/
|
tomwalters@54
|
105 # Run the conversion
|
tomwalters@165
|
106 ./cnbh-syllables/feature_generation/run_aimcopy.sh $FEATURES_ROOT/aim/$SOURCE_SNR/ $NUMBER_OF_CORES
|
tomwalters@98
|
107 touch $FEATURES_ROOT/aim/$SOURCE_SNR/.make_aim_features_success
|
tomwalters@176
|
108 fi
|
tomwalters@165
|
109 done
|
tomwalters@82
|
110
|
tomwalters@54
|
111 # Now run a bunch of experiments.
|
tomwalters@54
|
112 # For each of the feature types, we want to run HMMs with a bunch of
|
tomwalters@54
|
113 # parameters.
|
tomwalters@165
|
114 TRAINING_ITERATIONS="0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20"
|
tomwalters@165
|
115 TESTING_ITERATIONS="1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20"
|
tomwalters@165
|
116 HMM_STATES="3 4 5 6 7 8"
|
tomwalters@165
|
117 HMM_OUTPUT_COMPONENTS=""
|
tomwalters@91
|
118
|
tomwalters@186
|
119 FEATURE_CLASS=mfcc
|
tomwalters@186
|
120 FEATURE_SIZE=39
|
tomwalters@186
|
121 FEATURE_TYPE=MFCC_0_D_A
|
tomwalters@93
|
122
|
tomwalters@186
|
123 for SOURCE_SNR in $FEATURE_DIRS; do
|
tomwalters@186
|
124 ./run_training_and_testing/test_features.sh \
|
tomwalters@186
|
125 $HMMS_ROOT \
|
tomwalters@186
|
126 $FEATURES_ROOT/$FEATURE_CLASS/$SOURCE_SNR/ \
|
tomwalters@186
|
127 $FEATURE_SUFFIX \
|
tomwalters@186
|
128 $HMM_STATES \
|
tomwalters@186
|
129 $HMM_OUTPUT_COMPONENTS \
|
tomwalters@186
|
130 $TRAINING_ITERATIONS \
|
tomwalters@186
|
131 $TESTING_ITERATIONS \
|
tomwalters@186
|
132 $FEATURE_SIZE \
|
tomwalters@186
|
133 $FEATURE_TYPE
|
tomwalters@186
|
134 done |