annotate experiments/scripts/master.sh @ 243:5a0cd3fb3089

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