annotate experiments/scripts/master.sh @ 131:517a7563985a

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