annotate experiments/scripts/master.sh @ 129:e0130f838e10

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