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@54
|
7 # This script expects the HTK binaries and AIM-C AIMCopy binary to be present
|
tomwalters@54
|
8 # in the PATH.
|
tomwalters@54
|
9
|
tomwalters@54
|
10 # Set these to be the location of your input database, and desired output
|
tomwalters@54
|
11 # locations.
|
tomwalters@67
|
12 SYLLABLES_DATABASE_TAR=/mnt/sounds/cnbh-syllables.tar
|
tomwalters@54
|
13 SOUNDS_ROOT=/mnt/experiments/sounds/
|
tomwalters@54
|
14 FEATURES_ROOT=/mnt/experiments/features/
|
tomwalters@54
|
15 HMMS_ROOT=/mnt/experiments/hmms/
|
tomwalters@54
|
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@73
|
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@67
|
27 if [ ! -e $SYLLABLES_DATABASE_TAR ]; then
|
tomwalters@67
|
28 sudo mkdir -p `dirname $SYLLABLES_DATABASE_TAR`
|
tomwalters@67
|
29 sudo chown ubuntu `dirname $SYLLABLES_DATABASE_TAR`
|
tomwalters@67
|
30 wget -O $SYLLABLES_DATABASE_TAR $SYLLABLES_DATABASE_URL
|
tomwalters@67
|
31 fi
|
tomwalters@67
|
32
|
tomwalters@54
|
33 if [ ! -d $SOUNDS_ROOT ]; then
|
tomwalters@58
|
34 sudo mkdir -p $SOUNDS_ROOT
|
tomwalters@58
|
35 sudo chown `whoami` $SOUNDS_ROOT
|
tomwalters@54
|
36 fi
|
tomwalters@54
|
37
|
tomwalters@54
|
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@74
|
45 echo "Converting CNBH-syllables database from FLAC to WAV..."
|
tomwalters@60
|
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@80
|
51 #SNRS="30 27 24 21 18 15 12 9 6 3 0"
|
tomwalters@80
|
52 SNRS="30" # For testing
|
tomwalters@75
|
53 ./cnbh-syllables/feature_generation/pink_noise.sh $SOUNDS_ROOT/clean/ "$SNRS"
|
tomwalters@54
|
54
|
tomwalters@54
|
55 # Make the list of all feature drectories
|
tomwalters@54
|
56 FEATURE_DIRS="clean"
|
tomwalters@54
|
57 for SNR in $SNRS; do
|
tomwalters@54
|
58 FEATURE_DIRS="$FEATURE_DIRS snr_${SNR}dB"
|
tomwalters@54
|
59 done
|
tomwalters@54
|
60
|
tomwalters@54
|
61 # Generate feature sets (for the full range of SNRs in $FEATURE_DIRS)
|
tomwalters@54
|
62 # 1. Standard MFCC features
|
tomwalters@54
|
63 # 2. AIM features
|
tomwalters@54
|
64 # 3. MFCC features with optimal VTLN
|
tomwalters@58
|
65
|
tomwalters@58
|
66
|
tomwalters@58
|
67 if [ ! -d $FEATURES_ROOT ]; then
|
tomwalters@58
|
68 sudo mkdir -p $FEATURES_ROOT
|
tomwalters@58
|
69 sudo chown `whoami` $FEATURES_ROOT
|
tomwalters@58
|
70 fi
|
tomwalters@58
|
71
|
tomwalters@69
|
72 if [ ! -e /mnt/experiments/htk/.htk_installed_success ]; then
|
tomwalters@69
|
73 ./HTK/install_htk.sh
|
tomwalters@70
|
74 fi
|
tomwalters@69
|
75
|
tomwalters@73
|
76 if [ ! -e /mnt/experiments/aimc/.aimc_build_success ]; then
|
tomwalters@72
|
77 # ./aimc/build_aimc.sh
|
tomwalters@72
|
78 cd ../../
|
tomwalters@72
|
79 scons
|
tomwalters@72
|
80 export PATH=$PATH:`pwd`/build/posix-release/
|
tomwalters@72
|
81 cd -
|
tomwalters@72
|
82 fi
|
tomwalters@72
|
83
|
tomwalters@54
|
84 for SOURCE_SNR in $FEATURE_DIRS; do
|
tomwalters@54
|
85
|
tomwalters@66
|
86 if [ ! -e $FEATURES_ROOT/mfcc/$SOURCE_SNR/.make_mfcc_features_success ]; then
|
tomwalters@54
|
87 mkdir -p $FEATURES_ROOT/mfcc/$SOURCE_SNR/
|
tomwalters@54
|
88 # Generate the list of files to convert
|
tomwalters@78
|
89 ./cnbh-syllables/feature_generation/gen_hcopy_aimcopy_script.sh $FEATURES_ROOT/mfcc/$SOURCE_SNR/ $SOUNDS_ROOT/$SOURCE_SNR/ htk
|
tomwalters@54
|
90 # Run the conversion
|
tomwalters@54
|
91 ./cnbh-syllables/feature_generation/run_hcopy.sh $FEATURES_ROOT/mfcc/$SOURCE_SNR/ $NUMBER_OF_CORES
|
tomwalters@54
|
92 touch $FEATURES_ROOT/mfcc/$SOURCE_SNR/.make_mfcc_features_success
|
tomwalters@65
|
93 fi
|
tomwalters@54
|
94
|
tomwalters@66
|
95 if [ ! -e $FEATURES_ROOT/mfcc_vtln/$SOURCE_SNR/.make_mfcc_vtln_features_success ]; then
|
tomwalters@54
|
96 mkdir -p $FEATURES_ROOT/mfcc_vtln/$SOURCE_SNR/
|
tomwalters@54
|
97 # Generate the file list and run the conversion (all one step, since this
|
tomwalters@75
|
98 # version uses a different configuration for each talker)
|
tomwalters@54
|
99 ./cnbh-syllables/feature_generation/run_mfcc_vtln_conversion.sh $FEATURES_ROOT/mfcc_vtln/$SOURCE_SNR/ $SOUNDS_ROOT/$SOURCE_SNR/
|
tomwalters@54
|
100 touch $FEATURES_ROOT/mfcc_vtln/$SOURCE_SNR/.make_mfcc_vtln_features_success
|
tomwalters@65
|
101 fi
|
tomwalters@54
|
102
|
tomwalters@66
|
103 if [ ! -e $FEATURES_ROOT/aim/$SOURCE_SNR/.make_aim_features_success ]; then
|
tomwalters@54
|
104 mkdir -p $FEATURES_ROOT/aim/$SOURCE_SNR/
|
tomwalters@78
|
105 ./cnbh-syllables/feature_generation/gen_hcopy_aimcopy_script.sh $FEATURES_ROOT/aim/$SOURCE_SNR/ $SOUNDS_ROOT/$SOURCE_SNR/ ""
|
tomwalters@54
|
106 # Run the conversion
|
tomwalters@80
|
107 #./cnbh-syllables/feature_generation/run_aimcopy.sh $FEATURES_ROOT/aim/$SOURCE_SNR/ $NUMBER_OF_CORES
|
tomwalters@80
|
108 #touch $FEATURES_ROOT/aim/$SOURCE_SNR/.make_aim_features_success
|
tomwalters@65
|
109 fi
|
tomwalters@54
|
110 done
|
tomwalters@54
|
111
|
tomwalters@54
|
112 # Now run a bunch of experiments.
|
tomwalters@54
|
113 # For each of the feature types, we want to run HMMs with a bunch of
|
tomwalters@54
|
114 # parameters.
|
tomwalters@54
|
115 TRAINING_ITERATIONS="0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20"
|
tomwalters@54
|
116 TESTING_ITERATIONS="1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20"
|
tomwalters@54
|
117 HMM_STATES="3 4 5 6 7 8"
|
tomwalters@76
|
118 HMM_OUTPUT_COMPONENTS="1 2 3 4 5 6"
|
tomwalters@54
|
119
|
tomwalters@75
|
120 FEATURE_CLASS=mfcc
|
tomwalters@79
|
121 FEATURE_SUFFIX=htk
|
tomwalters@75
|
122 FEATURE_SIZE=39
|
tomwalters@75
|
123 FEATURE_TYPE=MFCC_0_D_A
|
tomwalters@54
|
124
|
tomwalters@78
|
125 TALKERS=inner_talkers
|
tomwalters@78
|
126 WORK=$HMMS_ROOT/$FEATURE_CLASS/$FEATURE_SUFFIX/$SOURCE_SNR/$TALKERS/
|
tomwalters@80
|
127 sudo mkdir -p $WORK
|
tomwalters@80
|
128 sudo chown ubuntu $WORK
|
tomwalters@78
|
129 FEATURES_DIR=$FEATURES_ROOT/$FEATURE_CLASS/$SOURCE_SNR/
|
tomwalters@78
|
130
|
tomwalters@80
|
131 ./cnbh-syllables/run_training_and_testing/train_test_sets/generate_train_test_lists.sh \
|
tomwalters@76
|
132 $TALKERS \
|
tomwalters@76
|
133 $WORK \
|
tomwalters@76
|
134 $FEATURES_DIR \
|
tomwalters@76
|
135 $FEATURE_SUFFIX
|
tomwalters@76
|
136
|
tomwalters@81
|
137 TRAINING_SCRIPT=$WORK/training_script
|
tomwalters@81
|
138 TESTING_SCRIPT=$WORK/testing_script
|
tomwalters@81
|
139
|
tomwalters@75
|
140 for SOURCE_SNR in $FEATURE_DIRS; do
|
tomwalters@80
|
141 ./cnbh-syllables/run_training_and_testing/test_features.sh \
|
tomwalters@75
|
142 $HMMS_ROOT \
|
tomwalters@75
|
143 $FEATURES_ROOT/$FEATURE_CLASS/$SOURCE_SNR/ \
|
tomwalters@75
|
144 $FEATURE_SUFFIX \
|
tomwalters@75
|
145 $HMM_STATES \
|
tomwalters@75
|
146 $HMM_OUTPUT_COMPONENTS \
|
tomwalters@75
|
147 $TRAINING_ITERATIONS \
|
tomwalters@75
|
148 $TESTING_ITERATIONS \
|
tomwalters@75
|
149 $FEATURE_SIZE \
|
tomwalters@76
|
150 $FEATURE_TYPE \
|
tomwalters@76
|
151 $TRAINING_SCRIPT \
|
tomwalters@76
|
152 $TESTING_SCRIPT
|
tomwalters@81
|
153 done
|