annotate trunk/experiments/scripts/master.sh @ 377:d318c1eb9a43

- AWS
author tomwalters
date Fri, 13 Aug 2010 10:57:10 +0000
parents 366821b2d155
children 646d104de415
rev   line source
tomwalters@335 1 #!/bin/bash
tomwalters@335 2 # Copyright 2010 Thomas Walters <tom@acousticscale.org>
tomwalters@335 3 #
tomwalters@335 4 # Run a series of experiments which compare MFCC features generated by HTK to
tomwalters@335 5 # AIM features generated using AIM-C using a series of syllable recogntiton
tomwalters@335 6 # tasks.
tomwalters@371 7 # This script expects to be run from within the AIM-C source tree.
tomwalters@371 8 # It builds the HTK binaries and AIM-C AIMCopy binary if they're not
tomwalters@371 9 # present.
tomwalters@371 10 # The following environment varaibles should be set before this script is run:
tomwalters@371 11 # SYLLABLES_DATABASE_URL - URL of a tar file containing the CNBH syllables
tomwalters@371 12 # database in FLAC format
tomwalters@371 13 # HTK_USERNAME and HTK_PASSWORD - username and password for the site at
tomwalters@371 14 # http://htk.eng.cam.ac.uk/
tomwalters@371 15
tomwalters@335 16 # Set these to be the location of your input database, and desired output
tomwalters@335 17 # locations.
tomwalters@348 18 SYLLABLES_DATABASE_TAR=/mnt/sounds/cnbh-syllables.tar
tomwalters@335 19 SOUNDS_ROOT=/mnt/experiments/sounds/
tomwalters@335 20 FEATURES_ROOT=/mnt/experiments/features/
tomwalters@335 21 HMMS_ROOT=/mnt/experiments/hmms/
tomwalters@335 22
tomwalters@335 23 # Number of cores on the experimental machine. Various scripts will try to use
tomwalters@335 24 # this if it's set.
tomwalters@377 25 NUMBER_OF_CORES=8
tomwalters@335 26
tomwalters@335 27 # Fail if any command fails
tomwalters@335 28 set -e
tomwalters@335 29
tomwalters@335 30 # Fail if any variable is unset
tomwalters@335 31 set -u
tomwalters@335 32
tomwalters@348 33 if [ ! -e $SYLLABLES_DATABASE_TAR ]; then
tomwalters@348 34 sudo mkdir -p `dirname $SYLLABLES_DATABASE_TAR`
tomwalters@348 35 sudo chown ubuntu `dirname $SYLLABLES_DATABASE_TAR`
tomwalters@348 36 wget -O $SYLLABLES_DATABASE_TAR $SYLLABLES_DATABASE_URL
tomwalters@348 37 fi
tomwalters@348 38
tomwalters@335 39 if [ ! -d $SOUNDS_ROOT ]; then
tomwalters@339 40 sudo mkdir -p $SOUNDS_ROOT
tomwalters@339 41 sudo chown `whoami` $SOUNDS_ROOT
tomwalters@335 42 fi
tomwalters@335 43
tomwalters@335 44 # Untar the CNBH syllables database, and convert the files from FLAC to WAV
tomwalters@335 45 if [ ! -e $SOUNDS_ROOT/.untar_db_success ]; then
tomwalters@335 46 tar -x -C $SOUNDS_ROOT -f $SYLLABLES_DATABASE_TAR
tomwalters@335 47 touch $SOUNDS_ROOT/.untar_db_success
tomwalters@335 48 fi
tomwalters@335 49
tomwalters@335 50 # Convert the database to .WAV format and place it in $SOUNDS_ROOT/clean
tomwalters@355 51 echo "Converting CNBH-syllables database from FLAC to WAV..."
tomwalters@341 52 ./cnbh-syllables/feature_generation/convert_flac_to_wav.sh $SOUNDS_ROOT
tomwalters@335 53
tomwalters@335 54 # Generate versions of the CNBH syllables spoke pattern with a range of
tomwalters@335 55 # signal-to-noise ratios (SNRs). The versions are put in the directory
tomwalters@335 56 # ${SOUNDS_ROOT}/${SNR}_dB/ for each SNR in $SNRS.
tomwalters@377 57 SNRS="30 27 24 21 18 15 12 9 6 3 0"
tomwalters@377 58 #SNRS="30" # For testing
tomwalters@356 59 ./cnbh-syllables/feature_generation/pink_noise.sh $SOUNDS_ROOT/clean/ "$SNRS"
tomwalters@335 60
tomwalters@335 61 # Make the list of all feature drectories
tomwalters@335 62 FEATURE_DIRS="clean"
tomwalters@335 63 for SNR in $SNRS; do
tomwalters@335 64 FEATURE_DIRS="$FEATURE_DIRS snr_${SNR}dB"
tomwalters@335 65 done
tomwalters@335 66
tomwalters@335 67 # Generate feature sets (for the full range of SNRs in $FEATURE_DIRS)
tomwalters@335 68 # 1. Standard MFCC features
tomwalters@335 69 # 2. AIM features
tomwalters@335 70 # 3. MFCC features with optimal VTLN
tomwalters@339 71
tomwalters@339 72
tomwalters@339 73 if [ ! -d $FEATURES_ROOT ]; then
tomwalters@339 74 sudo mkdir -p $FEATURES_ROOT
tomwalters@339 75 sudo chown `whoami` $FEATURES_ROOT
tomwalters@339 76 fi
tomwalters@339 77
tomwalters@350 78 if [ ! -e /mnt/experiments/htk/.htk_installed_success ]; then
tomwalters@350 79 ./HTK/install_htk.sh
tomwalters@351 80 fi
tomwalters@350 81
tomwalters@354 82 if [ ! -e /mnt/experiments/aimc/.aimc_build_success ]; then
tomwalters@353 83 # ./aimc/build_aimc.sh
tomwalters@353 84 cd ../../
tomwalters@353 85 scons
tomwalters@353 86 export PATH=$PATH:`pwd`/build/posix-release/
tomwalters@353 87 cd -
tomwalters@353 88 fi
tomwalters@353 89
tomwalters@335 90 for SOURCE_SNR in $FEATURE_DIRS; do
tomwalters@335 91
tomwalters@347 92 if [ ! -e $FEATURES_ROOT/mfcc/$SOURCE_SNR/.make_mfcc_features_success ]; then
tomwalters@335 93 mkdir -p $FEATURES_ROOT/mfcc/$SOURCE_SNR/
tomwalters@335 94 # Generate the list of files to convert
tomwalters@359 95 ./cnbh-syllables/feature_generation/gen_hcopy_aimcopy_script.sh $FEATURES_ROOT/mfcc/$SOURCE_SNR/ $SOUNDS_ROOT/$SOURCE_SNR/ htk
tomwalters@335 96 # Run the conversion
tomwalters@335 97 ./cnbh-syllables/feature_generation/run_hcopy.sh $FEATURES_ROOT/mfcc/$SOURCE_SNR/ $NUMBER_OF_CORES
tomwalters@335 98 touch $FEATURES_ROOT/mfcc/$SOURCE_SNR/.make_mfcc_features_success
tomwalters@346 99 fi
tomwalters@335 100
tomwalters@347 101 if [ ! -e $FEATURES_ROOT/mfcc_vtln/$SOURCE_SNR/.make_mfcc_vtln_features_success ]; then
tomwalters@335 102 mkdir -p $FEATURES_ROOT/mfcc_vtln/$SOURCE_SNR/
tomwalters@335 103 # Generate the file list and run the conversion (all one step, since this
tomwalters@356 104 # version uses a different configuration for each talker)
tomwalters@335 105 ./cnbh-syllables/feature_generation/run_mfcc_vtln_conversion.sh $FEATURES_ROOT/mfcc_vtln/$SOURCE_SNR/ $SOUNDS_ROOT/$SOURCE_SNR/
tomwalters@335 106 touch $FEATURES_ROOT/mfcc_vtln/$SOURCE_SNR/.make_mfcc_vtln_features_success
tomwalters@346 107 fi
tomwalters@335 108
tomwalters@347 109 if [ ! -e $FEATURES_ROOT/aim/$SOURCE_SNR/.make_aim_features_success ]; then
tomwalters@335 110 mkdir -p $FEATURES_ROOT/aim/$SOURCE_SNR/
tomwalters@359 111 ./cnbh-syllables/feature_generation/gen_hcopy_aimcopy_script.sh $FEATURES_ROOT/aim/$SOURCE_SNR/ $SOUNDS_ROOT/$SOURCE_SNR/ ""
tomwalters@335 112 # Run the conversion
tomwalters@361 113 #./cnbh-syllables/feature_generation/run_aimcopy.sh $FEATURES_ROOT/aim/$SOURCE_SNR/ $NUMBER_OF_CORES
tomwalters@361 114 #touch $FEATURES_ROOT/aim/$SOURCE_SNR/.make_aim_features_success
tomwalters@346 115 fi
tomwalters@335 116 done
tomwalters@335 117
tomwalters@363 118 sudo mkdir -p $HMMS_ROOT
tomwalters@363 119 sudo chown ubuntu $HMMS_ROOT
tomwalters@363 120
tomwalters@335 121 # Now run a bunch of experiments.
tomwalters@335 122 # For each of the feature types, we want to run HMMs with a bunch of
tomwalters@335 123 # parameters.
tomwalters@335 124 TRAINING_ITERATIONS="0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20"
tomwalters@335 125 TESTING_ITERATIONS="1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20"
tomwalters@335 126 HMM_STATES="3 4 5 6 7 8"
tomwalters@372 127 HMM_OUTPUT_COMPONENTS="1 2 3 4 5 6 7"
tomwalters@335 128
tomwalters@372 129
tomwalters@374 130 run_train_test () {
tomwalters@377 131 # TODO(tom): Make sure that the training SNR is generated first
tomwalters@374 132 for SOURCE_SNR in $FEATURE_DIRS; do
tomwalters@374 133 WORK=$HMMS_ROOT/$FEATURE_CLASS/$FEATURE_SUFFIX/$SOURCE_SNR/$TALKERS/
tomwalters@374 134 mkdir -p $WORK
tomwalters@374 135 FEATURES_DIR=$FEATURES_ROOT/$FEATURE_CLASS/$SOURCE_SNR/
tomwalters@374 136
tomwalters@374 137 ./cnbh-syllables/run_training_and_testing/train_test_sets/generate_train_test_lists.sh \
tomwalters@374 138 $TALKERS \
tomwalters@374 139 $WORK \
tomwalters@374 140 $FEATURES_DIR \
tomwalters@374 141 $FEATURE_SUFFIX
tomwalters@374 142
tomwalters@377 143 TRAINING_SCRIPT=$HMMS_ROOT/$FEATURE_CLASS/$FEATURE_SUFFIX/$TRAINING_SNR/$TALKERS/training_script
tomwalters@377 144 TRAINING_MASTER_LABEL_FILE=$HMMS_ROOT/$FEATURE_CLASS/$FEATURE_SUFFIX/$TRAINING_SNR/$TALKERS/training_master_label_file
tomwalters@377 145
tomwalters@374 146 TESTING_SCRIPT=$WORK/testing_script
tomwalters@377 147 TESTING_MASTER_LABEL_FILE=$WORK/testing_master_label_file
tomwalters@374 148
tomwalters@374 149 ./cnbh-syllables/run_training_and_testing/gen_htk_base_files.sh $WORK
tomwalters@374 150
tomwalters@374 151 ./cnbh-syllables/run_training_and_testing/test_features.sh \
tomwalters@374 152 "$WORK" \
tomwalters@374 153 "$FEATURES_ROOT/$FEATURE_CLASS/$SOURCE_SNR/" \
tomwalters@374 154 "$FEATURE_SUFFIX" \
tomwalters@374 155 "$HMM_STATES" \
tomwalters@374 156 "$HMM_OUTPUT_COMPONENTS" \
tomwalters@374 157 "$TRAINING_ITERATIONS" \
tomwalters@374 158 "$TESTING_ITERATIONS" \
tomwalters@374 159 "$FEATURE_SIZE" \
tomwalters@374 160 "$FEATURE_TYPE" \
tomwalters@374 161 "$TRAINING_SCRIPT" \
tomwalters@374 162 "$TESTING_SCRIPT" \
tomwalters@376 163 "$TRAINING_MASTER_LABEL_FILE" \
tomwalters@376 164 "$TESTING_MASTER_LABEL_FILE"
tomwalters@374 165 done
tomwalters@374 166 }
tomwalters@374 167
tomwalters@374 168
tomwalters@372 169 ########################
tomwalters@372 170 # Standard MFCCs
tomwalters@356 171 FEATURE_CLASS=mfcc
tomwalters@360 172 FEATURE_SUFFIX=htk
tomwalters@356 173 FEATURE_SIZE=39
tomwalters@356 174 FEATURE_TYPE=MFCC_0_D_A
tomwalters@372 175 TALKERS=inner_talkers
tomwalters@377 176 TRAINING_SNR=clean
tomwalters@372 177 run_train_test
tomwalters@372 178 ########################
tomwalters@335 179
tomwalters@372 180 ########################
tomwalters@372 181 # Standard MFCCs
tomwalters@372 182 # Train on extrema
tomwalters@372 183 FEATURE_CLASS=mfcc
tomwalters@372 184 FEATURE_SUFFIX=htk
tomwalters@372 185 FEATURE_SIZE=39
tomwalters@372 186 FEATURE_TYPE=MFCC_0_D_A
tomwalters@372 187 TALKERS=outer_talkers
tomwalters@377 188 TRAINING_SNR=clean
tomwalters@372 189 run_train_test
tomwalters@372 190 ########################
tomwalters@372 191
tomwalters@372 192 ########################
tomwalters@372 193 # MFCCs with VTLN
tomwalters@372 194 FEATURE_CLASS=mfcc_vtln
tomwalters@372 195 FEATURE_SUFFIX=htk
tomwalters@372 196 FEATURE_SIZE=39
tomwalters@372 197 FEATURE_TYPE=MFCC_0_D_A
tomwalters@359 198 TALKERS=inner_talkers
tomwalters@377 199 TRAINING_SNR=clean
tomwalters@372 200 run_train_test
tomwalters@372 201 ########################
tomwalters@372 202
tomwalters@372 203 ########################
tomwalters@372 204 # MFCCs with VTLN
tomwalters@372 205 # Train on extrema
tomwalters@372 206 FEATURE_CLASS=mfcc_vtln
tomwalters@372 207 FEATURE_SUFFIX=htk
tomwalters@372 208 FEATURE_SIZE=39
tomwalters@372 209 FEATURE_TYPE=MFCC_0_D_A
tomwalters@372 210 TALKERS=outer_talkers
tomwalters@377 211 TRAINING_SNR=clean
tomwalters@372 212 run_train_test
tomwalters@372 213 ########################
tomwalters@372 214
tomwalters@372 215 ########################
tomwalters@372 216 # AIM Features
tomwalters@372 217 # TODO (loop over all feature suffixes)
tomwalters@372 218 ########################
tomwalters@372 219
tomwalters@372 220
tomwalters@359 221
tomwalters@357 222
tomwalters@362 223