annotate trunk/experiments/scripts/master.sh @ 385:040a07935a28

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