annotate trunk/experiments/scripts/master.sh @ 379:646d104de415

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