annotate experiments/scripts/master.sh @ 212:b50a09ac97ec

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