annotate trunk/experiments/scripts/master.sh @ 359:7074795fd2eb

- AWS
author tomwalters
date Wed, 11 Aug 2010 23:54:37 +0000
parents 74c185b2b918
children b5cc3b21f8db
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@335 7 # This script expects the HTK binaries and AIM-C AIMCopy binary to be present
tomwalters@335 8 # in the PATH.
tomwalters@335 9
tomwalters@335 10 # Set these to be the location of your input database, and desired output
tomwalters@335 11 # locations.
tomwalters@348 12 SYLLABLES_DATABASE_TAR=/mnt/sounds/cnbh-syllables.tar
tomwalters@335 13 SOUNDS_ROOT=/mnt/experiments/sounds/
tomwalters@335 14 FEATURES_ROOT=/mnt/experiments/features/
tomwalters@335 15 HMMS_ROOT=/mnt/experiments/hmms/
tomwalters@335 16
tomwalters@335 17 # Number of cores on the experimental machine. Various scripts will try to use
tomwalters@335 18 # this if it's set.
tomwalters@354 19 NUMBER_OF_CORES=1
tomwalters@335 20
tomwalters@335 21 # Fail if any command fails
tomwalters@335 22 set -e
tomwalters@335 23
tomwalters@335 24 # Fail if any variable is unset
tomwalters@335 25 set -u
tomwalters@335 26
tomwalters@348 27 if [ ! -e $SYLLABLES_DATABASE_TAR ]; then
tomwalters@348 28 sudo mkdir -p `dirname $SYLLABLES_DATABASE_TAR`
tomwalters@348 29 sudo chown ubuntu `dirname $SYLLABLES_DATABASE_TAR`
tomwalters@348 30 wget -O $SYLLABLES_DATABASE_TAR $SYLLABLES_DATABASE_URL
tomwalters@348 31 fi
tomwalters@348 32
tomwalters@335 33 if [ ! -d $SOUNDS_ROOT ]; then
tomwalters@339 34 sudo mkdir -p $SOUNDS_ROOT
tomwalters@339 35 sudo chown `whoami` $SOUNDS_ROOT
tomwalters@335 36 fi
tomwalters@335 37
tomwalters@335 38 # Untar the CNBH syllables database, and convert the files from FLAC to WAV
tomwalters@335 39 if [ ! -e $SOUNDS_ROOT/.untar_db_success ]; then
tomwalters@335 40 tar -x -C $SOUNDS_ROOT -f $SYLLABLES_DATABASE_TAR
tomwalters@335 41 touch $SOUNDS_ROOT/.untar_db_success
tomwalters@335 42 fi
tomwalters@335 43
tomwalters@335 44 # Convert the database to .WAV format and place it in $SOUNDS_ROOT/clean
tomwalters@355 45 echo "Converting CNBH-syllables database from FLAC to WAV..."
tomwalters@341 46 ./cnbh-syllables/feature_generation/convert_flac_to_wav.sh $SOUNDS_ROOT
tomwalters@335 47
tomwalters@335 48 # Generate versions of the CNBH syllables spoke pattern with a range of
tomwalters@335 49 # signal-to-noise ratios (SNRs). The versions are put in the directory
tomwalters@335 50 # ${SOUNDS_ROOT}/${SNR}_dB/ for each SNR in $SNRS.
tomwalters@358 51 #SNRS="30 27 24 21 18 15 12 9 6 3 0"
tomwalters@358 52 SNRS="30" # For testing
tomwalters@356 53 ./cnbh-syllables/feature_generation/pink_noise.sh $SOUNDS_ROOT/clean/ "$SNRS"
tomwalters@335 54
tomwalters@335 55 # Make the list of all feature drectories
tomwalters@335 56 FEATURE_DIRS="clean"
tomwalters@335 57 for SNR in $SNRS; do
tomwalters@335 58 FEATURE_DIRS="$FEATURE_DIRS snr_${SNR}dB"
tomwalters@335 59 done
tomwalters@335 60
tomwalters@335 61 # Generate feature sets (for the full range of SNRs in $FEATURE_DIRS)
tomwalters@335 62 # 1. Standard MFCC features
tomwalters@335 63 # 2. AIM features
tomwalters@335 64 # 3. MFCC features with optimal VTLN
tomwalters@339 65
tomwalters@339 66
tomwalters@339 67 if [ ! -d $FEATURES_ROOT ]; then
tomwalters@339 68 sudo mkdir -p $FEATURES_ROOT
tomwalters@339 69 sudo chown `whoami` $FEATURES_ROOT
tomwalters@339 70 fi
tomwalters@339 71
tomwalters@350 72 if [ ! -e /mnt/experiments/htk/.htk_installed_success ]; then
tomwalters@350 73 ./HTK/install_htk.sh
tomwalters@351 74 fi
tomwalters@350 75
tomwalters@354 76 if [ ! -e /mnt/experiments/aimc/.aimc_build_success ]; then
tomwalters@353 77 # ./aimc/build_aimc.sh
tomwalters@353 78 cd ../../
tomwalters@353 79 scons
tomwalters@353 80 export PATH=$PATH:`pwd`/build/posix-release/
tomwalters@353 81 cd -
tomwalters@353 82 fi
tomwalters@353 83
tomwalters@335 84 for SOURCE_SNR in $FEATURE_DIRS; do
tomwalters@335 85
tomwalters@347 86 if [ ! -e $FEATURES_ROOT/mfcc/$SOURCE_SNR/.make_mfcc_features_success ]; then
tomwalters@335 87 mkdir -p $FEATURES_ROOT/mfcc/$SOURCE_SNR/
tomwalters@335 88 # Generate the list of files to convert
tomwalters@359 89 ./cnbh-syllables/feature_generation/gen_hcopy_aimcopy_script.sh $FEATURES_ROOT/mfcc/$SOURCE_SNR/ $SOUNDS_ROOT/$SOURCE_SNR/ htk
tomwalters@335 90 # Run the conversion
tomwalters@335 91 ./cnbh-syllables/feature_generation/run_hcopy.sh $FEATURES_ROOT/mfcc/$SOURCE_SNR/ $NUMBER_OF_CORES
tomwalters@335 92 touch $FEATURES_ROOT/mfcc/$SOURCE_SNR/.make_mfcc_features_success
tomwalters@346 93 fi
tomwalters@335 94
tomwalters@347 95 if [ ! -e $FEATURES_ROOT/mfcc_vtln/$SOURCE_SNR/.make_mfcc_vtln_features_success ]; then
tomwalters@335 96 mkdir -p $FEATURES_ROOT/mfcc_vtln/$SOURCE_SNR/
tomwalters@335 97 # Generate the file list and run the conversion (all one step, since this
tomwalters@356 98 # version uses a different configuration for each talker)
tomwalters@335 99 ./cnbh-syllables/feature_generation/run_mfcc_vtln_conversion.sh $FEATURES_ROOT/mfcc_vtln/$SOURCE_SNR/ $SOUNDS_ROOT/$SOURCE_SNR/
tomwalters@335 100 touch $FEATURES_ROOT/mfcc_vtln/$SOURCE_SNR/.make_mfcc_vtln_features_success
tomwalters@346 101 fi
tomwalters@335 102
tomwalters@347 103 if [ ! -e $FEATURES_ROOT/aim/$SOURCE_SNR/.make_aim_features_success ]; then
tomwalters@335 104 mkdir -p $FEATURES_ROOT/aim/$SOURCE_SNR/
tomwalters@359 105 ./cnbh-syllables/feature_generation/gen_hcopy_aimcopy_script.sh $FEATURES_ROOT/aim/$SOURCE_SNR/ $SOUNDS_ROOT/$SOURCE_SNR/ ""
tomwalters@335 106 # Run the conversion
tomwalters@335 107 ./cnbh-syllables/feature_generation/run_aimcopy.sh $FEATURES_ROOT/aim/$SOURCE_SNR/ $NUMBER_OF_CORES
tomwalters@335 108 touch $FEATURES_ROOT/aim/$SOURCE_SNR/.make_aim_features_success
tomwalters@346 109 fi
tomwalters@335 110 done
tomwalters@335 111
tomwalters@335 112 # Now run a bunch of experiments.
tomwalters@335 113 # For each of the feature types, we want to run HMMs with a bunch of
tomwalters@335 114 # parameters.
tomwalters@335 115 TRAINING_ITERATIONS="0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20"
tomwalters@335 116 TESTING_ITERATIONS="1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20"
tomwalters@335 117 HMM_STATES="3 4 5 6 7 8"
tomwalters@357 118 HMM_OUTPUT_COMPONENTS="1 2 3 4 5 6"
tomwalters@335 119
tomwalters@356 120 FEATURE_CLASS=mfcc
tomwalters@357 121 FEATURE_SUFFIX=mfc
tomwalters@356 122 FEATURE_SIZE=39
tomwalters@356 123 FEATURE_TYPE=MFCC_0_D_A
tomwalters@335 124
tomwalters@359 125 TALKERS=inner_talkers
tomwalters@359 126 WORK=$HMMS_ROOT/$FEATURE_CLASS/$FEATURE_SUFFIX/$SOURCE_SNR/$TALKERS/
tomwalters@359 127 mkdir -p $WORK
tomwalters@359 128 FEATURES_DIR=$FEATURES_ROOT/$FEATURE_CLASS/$SOURCE_SNR/
tomwalters@359 129
tomwalters@357 130 ./run_training_and_testing/train_test_sets/generate_train_test_lists.sh \
tomwalters@357 131 $TALKERS \
tomwalters@357 132 $WORK \
tomwalters@357 133 $FEATURES_DIR \
tomwalters@357 134 $FEATURE_SUFFIX
tomwalters@357 135
tomwalters@356 136 for SOURCE_SNR in $FEATURE_DIRS; do
tomwalters@356 137 ./run_training_and_testing/test_features.sh \
tomwalters@356 138 $HMMS_ROOT \
tomwalters@356 139 $FEATURES_ROOT/$FEATURE_CLASS/$SOURCE_SNR/ \
tomwalters@356 140 $FEATURE_SUFFIX \
tomwalters@356 141 $HMM_STATES \
tomwalters@356 142 $HMM_OUTPUT_COMPONENTS \
tomwalters@356 143 $TRAINING_ITERATIONS \
tomwalters@356 144 $TESTING_ITERATIONS \
tomwalters@356 145 $FEATURE_SIZE \
tomwalters@357 146 $FEATURE_TYPE \
tomwalters@357 147 $TRAINING_SCRIPT \
tomwalters@357 148 $TESTING_SCRIPT
tomwalters@356 149 done