annotate make_structure_image.m @ 6:e2337cd691b1 tip

Finishing writing the matlab code to replicate all observations made in the article. Added the article to the repository. Renamed the two main scripts ("1-get_mirex_estimates.rb" and "2-generate_smith2013_ismir.m") to not have dashes (since this was annoying within Matlab) Added new Michael Jackson figure.
author Jordan Smith <jordan.smith@eecs.qmul.ac.uk>
date Wed, 05 Mar 2014 01:02:26 +0000
parents
children
rev   line source
jordan@6 1 function make_structure_image(mirid, mirex_truth, mirex_output, mirex_results, mirex_dset_origin)
jordan@6 2 % Quick script to accept an input song number and output an image
jordan@6 3 % of the annotation against the estimated descriptions.
jordan@6 4
jordan@6 5 % Identify the dataset corresponding to the ID of that song.
jordan@6 6 dset = mirex_dset_origin(mirid);
jordan@6 7 % Provide the index into that dataset of the ID of that song.
jordan@6 8 id_in_dset = mirid + 1 - find(mirex_dset_origin==dset,1);
jordan@6 9
jordan@6 10 % Assemble all the song descriptions. Start with the annotation, then collect all the algorithm outputs.
jordan@6 11 descs = {};
jordan@6 12 descs{1} = mirex_truth(mirid);
jordan@6 13 for i=1:9,
jordan@6 14 descs{i+1} = mirex_output(dset).algo(i).song(id_in_dset);
jordan@6 15 end
jordan@6 16 % descs = descs([1 2 3 4 10 5 6 7 8 9]);
jordan@6 17 descorder = [1 2 3 4 6 7 8 9 10 5];
jordan@6 18
jordan@6 19 cmap = colormap;
jordan@6 20
jordan@6 21 gcf; clf, hold on
jordan@6 22 text_extent = max(descs{1}.tim);
jordan@6 23 for i=2:length(descs),
jordan@6 24 text_extent = max([text_extent, max(descs{i}.tim)]);
jordan@6 25 end
jordan@6 26 for i=1:length(descs),
jordan@6 27 s_colors = grp2idx(descs{i}.lab);
jordan@6 28 cmap_rows = round(s_colors*length(cmap)/max(s_colors));
jordan@6 29 y = descorder(i)*(-1);
jordan@6 30 for n=1:length(descs{i}.tim)-1,
jordan@6 31 pos = [descs{i}.tim(n), y, descs{i}.tim(n+1)-descs{i}.tim(n), 0.8];
jordan@6 32 cmap_row = cmap(cmap_rows(n),:);
jordan@6 33 rectangle('Position',pos,'FaceColor',cmap_row);
jordan@6 34 end
jordan@6 35 if i>1,
jordan@6 36 pwftmp = mirex_results(dset).algo(i-1).results(id_in_dset,3);
jordan@6 37 text(text_extent + 2,y+.5,num2str(pwftmp,2))
jordan@6 38 end
jordan@6 39 end
jordan@6 40 axis([0 text_extent+17 -10 0])
jordan@6 41 s = {'Ground Truth','KSP1','KSP2','KSP3','SP1','MHRAF','OYZS','SBV','SMGA1','SMGA2'};
jordan@6 42 set(gca,'YTickLabel',fliplr(s),'YTick',(-9.5:-0.5))