annotate trunk/experiments/scripts/master.sh @ 374:ba7037c15192

- AWS
author tomwalters
date Fri, 13 Aug 2010 10:20:38 +0000
parents 26833fbaa597
children 366821b2d155
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
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@354 26 NUMBER_OF_CORES=1
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@361 58 #SNRS="30 27 24 21 18 15 12 9 6 3 0"
tomwalters@361 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@335 98 ./cnbh-syllables/feature_generation/run_hcopy.sh $FEATURES_ROOT/mfcc/$SOURCE_SNR/ $NUMBER_OF_CORES
tomwalters@335 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@335 106 ./cnbh-syllables/feature_generation/run_mfcc_vtln_conversion.sh $FEATURES_ROOT/mfcc_vtln/$SOURCE_SNR/ $SOUNDS_ROOT/$SOURCE_SNR/
tomwalters@335 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@361 114 #./cnbh-syllables/feature_generation/run_aimcopy.sh $FEATURES_ROOT/aim/$SOURCE_SNR/ $NUMBER_OF_CORES
tomwalters@361 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@372 130
tomwalters@374 131 run_train_test () {
tomwalters@374 132 for SOURCE_SNR in $FEATURE_DIRS; do
tomwalters@374 133 #SOURCE_SNR="clean"
tomwalters@374 134 WORK=$HMMS_ROOT/$FEATURE_CLASS/$FEATURE_SUFFIX/$SOURCE_SNR/$TALKERS/
tomwalters@374 135 mkdir -p $WORK
tomwalters@374 136 FEATURES_DIR=$FEATURES_ROOT/$FEATURE_CLASS/$SOURCE_SNR/
tomwalters@374 137
tomwalters@374 138 ./cnbh-syllables/run_training_and_testing/train_test_sets/generate_train_test_lists.sh \
tomwalters@374 139 $TALKERS \
tomwalters@374 140 $WORK \
tomwalters@374 141 $FEATURES_DIR \
tomwalters@374 142 $FEATURE_SUFFIX
tomwalters@374 143
tomwalters@374 144 TESTING_SCRIPT=$WORK/testing_script
tomwalters@374 145
tomwalters@374 146 ./cnbh-syllables/run_training_and_testing/gen_htk_base_files.sh $WORK
tomwalters@374 147
tomwalters@374 148 ./cnbh-syllables/run_training_and_testing/test_features.sh \
tomwalters@374 149 "$WORK" \
tomwalters@374 150 "$FEATURES_ROOT/$FEATURE_CLASS/$SOURCE_SNR/" \
tomwalters@374 151 "$FEATURE_SUFFIX" \
tomwalters@374 152 "$HMM_STATES" \
tomwalters@374 153 "$HMM_OUTPUT_COMPONENTS" \
tomwalters@374 154 "$TRAINING_ITERATIONS" \
tomwalters@374 155 "$TESTING_ITERATIONS" \
tomwalters@374 156 "$FEATURE_SIZE" \
tomwalters@374 157 "$FEATURE_TYPE" \
tomwalters@374 158 "$TRAINING_SCRIPT" \
tomwalters@374 159 "$TESTING_SCRIPT" \
tomwalters@374 160 "$TRAINING_MASTER_LABEL_FILE"
tomwalters@374 161 done
tomwalters@374 162 }
tomwalters@374 163
tomwalters@374 164
tomwalters@372 165 ########################
tomwalters@372 166 # Standard MFCCs
tomwalters@356 167 FEATURE_CLASS=mfcc
tomwalters@360 168 FEATURE_SUFFIX=htk
tomwalters@356 169 FEATURE_SIZE=39
tomwalters@356 170 FEATURE_TYPE=MFCC_0_D_A
tomwalters@372 171 TALKERS=inner_talkers
tomwalters@372 172 TRAINING_SCRIPT=$HMMS_ROOT/$FEATURE_CLASS/$FEATURE_SUFFIX/clean/$TALKERS/training_script
tomwalters@372 173 TRAINING_MASTER_LABEL_FILE=$HMMS_ROOT/$FEATURE_CLASS/$FEATURE_SUFFIX/clean/$TALKERS/training_master_label_file
tomwalters@372 174 run_train_test
tomwalters@372 175 ########################
tomwalters@335 176
tomwalters@372 177 ########################
tomwalters@372 178 # Standard MFCCs
tomwalters@372 179 # Train on extrema
tomwalters@372 180 FEATURE_CLASS=mfcc
tomwalters@372 181 FEATURE_SUFFIX=htk
tomwalters@372 182 FEATURE_SIZE=39
tomwalters@372 183 FEATURE_TYPE=MFCC_0_D_A
tomwalters@372 184 TALKERS=outer_talkers
tomwalters@372 185 TRAINING_SCRIPT=$HMMS_ROOT/$FEATURE_CLASS/$FEATURE_SUFFIX/clean/$TALKERS/training_script
tomwalters@372 186 TRAINING_MASTER_LABEL_FILE=$HMMS_ROOT/$FEATURE_CLASS/$FEATURE_SUFFIX/clean/$TALKERS/training_master_label_file
tomwalters@372 187 run_train_test
tomwalters@372 188 ########################
tomwalters@372 189
tomwalters@372 190 ########################
tomwalters@372 191 # MFCCs with VTLN
tomwalters@372 192 FEATURE_CLASS=mfcc_vtln
tomwalters@372 193 FEATURE_SUFFIX=htk
tomwalters@372 194 FEATURE_SIZE=39
tomwalters@372 195 FEATURE_TYPE=MFCC_0_D_A
tomwalters@359 196 TALKERS=inner_talkers
tomwalters@372 197 TRAINING_SCRIPT=$HMMS_ROOT/$FEATURE_CLASS/$FEATURE_SUFFIX/clean/$TALKERS/training_script
tomwalters@372 198 TRAINING_MASTER_LABEL_FILE=$HMMS_ROOT/$FEATURE_CLASS/$FEATURE_SUFFIX/clean/$TALKERS/training_master_label_file
tomwalters@372 199 run_train_test
tomwalters@372 200 ########################
tomwalters@372 201
tomwalters@372 202 ########################
tomwalters@372 203 # MFCCs with VTLN
tomwalters@372 204 # Train on extrema
tomwalters@372 205 FEATURE_CLASS=mfcc_vtln
tomwalters@372 206 FEATURE_SUFFIX=htk
tomwalters@372 207 FEATURE_SIZE=39
tomwalters@372 208 FEATURE_TYPE=MFCC_0_D_A
tomwalters@372 209 TALKERS=outer_talkers
tomwalters@372 210 TRAINING_SCRIPT=$HMMS_ROOT/$FEATURE_CLASS/$FEATURE_SUFFIX/clean/$TALKERS/training_script
tomwalters@372 211 TRAINING_MASTER_LABEL_FILE=$HMMS_ROOT/$FEATURE_CLASS/$FEATURE_SUFFIX/clean/$TALKERS/training_master_label_file
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