annotate testdata/evaluation/run-nonorm.sh @ 325:4cf4313d7e30 livemode

Always use q=0.8 and accept the hit on speed -- the templates are made for that configuration and it does work better. Also some adjustments to thresholding and peak picking for live mode in particular.
author Chris Cannam
date Mon, 18 May 2015 13:58:27 +0100
parents 40684b5dd478
children
rev   line source
Chris@247 1 #!/bin/sh
Chris@247 2
Chris@247 3 trios_path="/home/cannam/Music/TRIOS_dataset"
Chris@247 4 yc="/home/cannam/code/may/bin/yc"
Chris@247 5
Chris@247 6 if [ ! -d "$trios_path" ]; then
Chris@247 7 echo "TRIOS dataset directory $trios_path not found, giving up"
Chris@247 8 exit 1
Chris@247 9 fi
Chris@247 10
Chris@247 11 if ! "$yc" -v ; then
Chris@247 12 echo "Failed to run Yeti compiler yc at $yc_path, giving up";
Chris@247 13 fi
Chris@247 14
Chris@247 15 if ! sonic-annotator -v ; then
Chris@247 16 echo "Failed to run sonic-annotator (not in PATH?), giving up"
Chris@247 17 exit 1
Chris@247 18 fi
Chris@247 19
Chris@247 20 rdffile="../../silvet.n3"
Chris@247 21 if [ ! -f "$rdffile" ] ; then
Chris@247 22 echo "Failed to find plugin RDF file at $rdffile, giving up"
Chris@247 23 exit 1
Chris@247 24 fi
Chris@247 25
Chris@247 26 case "$trios_path" in
Chris@247 27 *\ *) echo "TRIOS dataset path $trios_path has a space in it, this script won't handle that"; exit 1;;
Chris@247 28 esac
Chris@247 29
Chris@247 30 ( cd ../.. ; make -f Makefile.linux ) || exit 1
Chris@247 31
Chris@247 32 VAMP_PATH=../..
Chris@247 33 export VAMP_PATH
Chris@247 34
Chris@247 35 outfile="/tmp/$$"
Chris@247 36
Chris@247 37 tmpwav="/tmp/$$norm.wav"
Chris@247 38
Chris@247 39 instfile="/tmp/$$instruments.txt"
Chris@247 40
Chris@247 41 transfile="/tmp/$$transform.ttl"
Chris@247 42
Chris@247 43 trap 'rm -f "$outfile" "$tmpwav" "$instfile" "$transfile" "$outfile.lab"' 0
Chris@247 44
Chris@247 45 # Use the mix and single-instrument non-synthetic files for a (varied)
Chris@247 46 # subset of the TRIOS dataset. Omit percussion (but we still use the
Chris@247 47 # Take Five example, even though it's largely percussion, because it's
Chris@247 48 # a good test of how we do with other instruments in the presence of
Chris@247 49 # percussion).
Chris@247 50 infiles=`find "$trios_path" -name \*.wav -print | egrep '(mozart|lussier|take_five)' | grep -v _syn.wav | grep -v kick.wav | grep -v ride.wav | grep -v snare.wav`
Chris@247 51
Chris@247 52 grep Piano "$rdffile" | sed 's/^.*( *//' | sed 's/ *).*$//' | sed 's/ "/\n/g' | sed 's/"//g' | tr '[A-Z]' '[a-z]' | tail -n +2 | cat -n > "$instfile"
Chris@247 53
Chris@247 54 instrument_for() {
Chris@247 55 filename="$1"
Chris@247 56 base=`basename "$filename" .wav`
Chris@247 57 if [ "$base" = "saxophone" ]; then base="tenorsax"; fi
Chris@247 58 instrument_no=`grep "$base" "$instfile" | awk '{ print $1; }'`
Chris@247 59 if [ -z "$instrument_no" ] || [ -z "$base" ];
Chris@247 60 then echo 0
Chris@247 61 else echo "$instrument_no"
Chris@247 62 fi
Chris@247 63 }
Chris@247 64
Chris@247 65 echo
Chris@247 66 echo "Input files are:"
Chris@247 67 echo $infiles | fmt -1
Chris@247 68
Chris@247 69 time for infile in $infiles; do
Chris@247 70
Chris@247 71 echo
Chris@247 72 echo "Evaluating for file $infile..."
Chris@247 73
Chris@247 74 instrument=`instrument_for "$infile"`
Chris@247 75 case "$instrument" in
Chris@247 76 [0-9]*) ;;
Chris@247 77 *) echo "Instrument extraction failed for infile $infile -- not even default multi-instrument setting returned?"; exit 1;;
Chris@247 78 esac
Chris@247 79
Chris@247 80 piece=`basename \`dirname "$infile" \``
Chris@247 81 arrangement=`basename "$infile" .wav`
Chris@247 82
Chris@269 83 for mode in 1 0; do
Chris@269 84
Chris@269 85 echo
Chris@269 86 echo "For piece $piece, arrangement $arrangement, mode $mode, using instrument $instrument..."
Chris@247 87
Chris@269 88 # unlike run.sh we don't normalise the input here
Chris@269 89 cp "$infile" "$tmpwav"
Chris@247 90
Chris@269 91 # generate the transform by interpolating the instrument parameter
Chris@269 92 cat transform.ttl | \
Chris@269 93 sed "s/INSTRUMENT_PARAMETER/$instrument/" | \
Chris@269 94 sed "s/MODE_PARAMETER/$mode/" > "$transfile"
Chris@247 95
Chris@269 96 sonic-annotator \
Chris@269 97 --writer csv \
Chris@269 98 --csv-one-file "$outfile" \
Chris@269 99 --csv-force \
Chris@269 100 --transform "$transfile" \
Chris@269 101 "$tmpwav"
Chris@247 102
Chris@269 103 cat "$outfile" | \
Chris@269 104 sed 's/^[^,]*,//' | \
Chris@269 105 while IFS=, read start duration frequency level label; do
Chris@247 106 end=`echo "$start $duration + p" | dc`
Chris@247 107 echo -e "$start\t$end\t$frequency"
Chris@269 108 done > "$outfile.lab"
Chris@247 109
Chris@269 110 for ms in 50 100; do
Chris@269 111 mark=""
Chris@269 112 if [ "$ms" = "50" ]; then mark=" <-- main $piece/$arrangement"; fi;
Chris@269 113 echo
Chris@269 114 echo "Validating against ground truth at $ms ms:"
Chris@269 115 "$yc" ../scripts/evaluate_lab.yeti "$ms" "../TRIOS-groundtruth/$piece/$arrangement.lab" "$outfile.lab" | sed 's,$,'"$mark"','
Chris@269 116 echo
Chris@269 117 echo "Validating against MIREX submission at $ms ms:"
Chris@269 118 "$yc" ../scripts/evaluate_lab.yeti "$ms" "../TRIOS-mirex2012-matlab/$piece/$arrangement.lab" "$outfile.lab"
Chris@269 119 echo
Chris@269 120 echo "Validating MIREX against ground truth at $ms ms":
Chris@269 121 "$yc" ../scripts/evaluate_lab.yeti "$ms" "../TRIOS-groundtruth/$piece/$arrangement.lab" "../TRIOS-mirex2012-matlab/$piece/$arrangement.lab"
Chris@269 122 done;
Chris@269 123
Chris@247 124 echo
Chris@269 125 done
Chris@247 126 done