annotate experiments/scripts/cnbh-syllables/results_plotting/plot_all_results.m @ 54:90eebc3c02ca

- Scripts for running recognition experiments using AIM-C and HTK to compare MFCCs against features generated with AIM-C
author tomwalters
date Wed, 04 Aug 2010 06:41:56 +0000
parents
children ae195c41c7bd
rev   line source
tomwalters@54 1 % Plot a figure based on recognition data from the HTK-AIM features
tomwalters@54 2 % experiments - a reworking of the 'spider plots' by Jess Monaghan,
tomwalters@54 3 % Nick Fyson and Martin Vestergaard.
tomwalters@54 4 % Copyright 2009 University of Cambridge
tomwalters@54 5 % Author: Tom Walters <tcw24@cam>
tomwalters@54 6 function plot_all_results(exp_path)
tomwalters@54 7
tomwalters@54 8 % Load the results from the experimental directory
tomwalters@54 9 load([exp_path 'misclassified.txt_iter15']);
tomwalters@54 10
tomwalters@54 11 % The total number of syllables in the CNBH syllable database
tomwalters@54 12 num_points = 185;
tomwalters@54 13 target_VTL = 15;
tomwalters@54 14
tomwalters@54 15 misclassified(:, 1) = 1 - misclassified(:, 1) / num_points; %#ok<NODEF>
tomwalters@54 16
tomwalters@54 17 % The individual data points are plotted as spheres
tomwalters@54 18 sphere_size_x = 1.2;
tomwalters@54 19 sphere_size_y = 0.17;
tomwalters@54 20 sphere_size_z = 2.5;
tomwalters@54 21
tomwalters@54 22 % Get the location of the various points on the spoke pattern
tomwalters@54 23 [spokes, target] = get_spoke_points();
tomwalters@54 24 results = {};
tomwalters@54 25
tomwalters@54 26 % Fill the results vector
tomwalters@54 27 for i = 1:length(spokes)
tomwalters@54 28 results{i} = zeros(length(spokes{1}),1);
tomwalters@54 29 r=round(spokes{i}*10)/10;
tomwalters@54 30 for j = 1:length(spokes{i})
tomwalters@54 31 result = misclassified(misclassified(:,3) == r(j,2) ...
tomwalters@54 32 & misclassified(:,2) == r(j,1), 1);
tomwalters@54 33 if result
tomwalters@54 34 results{i}(j) = result;
tomwalters@54 35 else
tomwalters@54 36 results{i}(j) = 1.0;
tomwalters@54 37 end
tomwalters@54 38 end
tomwalters@54 39 results{i} = 100.0 * results{i};
tomwalters@54 40 spokes{i}(:,2) = target_VTL * target(2) ./ spokes{i}(:,2);
tomwalters@54 41 end
tomwalters@54 42
tomwalters@54 43 figure1 = figure;
tomwalters@54 44 axes1 = axes('Parent',figure1,'YScale','log','YMinorTick','on',...
tomwalters@54 45 'YMinorGrid','on',...
tomwalters@54 46 'XScale','log',...
tomwalters@54 47 'XMinorTick','on',...
tomwalters@54 48 'XMinorGrid','on');
tomwalters@54 49
tomwalters@54 50 shades = 50;
tomwalters@54 51 cmap = fliplr(autumn(shades));
tomwalters@54 52 for i=1:length(spokes)
tomwalters@54 53
tomwalters@54 54 hold on;
tomwalters@54 55 j=1;
tomwalters@54 56 x_pos = spokes{i}(j, 1);
tomwalters@54 57 y_pos = spokes{i}(j, 2);
tomwalters@54 58 z_pos = results{i}(j);
tomwalters@54 59 j=2;
tomwalters@54 60 x_pos_2 = spokes{i}(j, 1);
tomwalters@54 61 y_pos_2 = spokes{i}(j, 2);
tomwalters@54 62 z_pos_2 = results{i}(j);
tomwalters@54 63
tomwalters@54 64 text(x_pos + 0.3*(x_pos - x_pos_2), y_pos + 0.3*(y_pos - y_pos_2), z_pos + 0.3*(z_pos - z_pos_2) , [num2str(results{i}(j), 3) '%']);
tomwalters@54 65 for j = 1:length(spokes{i})
tomwalters@54 66 [X Y Z] = sphere(10);
tomwalters@54 67 X = sphere_size_x.*X + spokes{i}(j,1);
tomwalters@54 68 Y = sphere_size_y.*Y + spokes{i}(j,2);
tomwalters@54 69 Z = sphere_size_z.*Z + results{i}(j);
tomwalters@54 70 % C = zeros(size(X));
tomwalters@54 71 plot3([spokes{i}(j, 1) spokes{i}(j, 1)], ...
tomwalters@54 72 [spokes{i}(j, 2),spokes{i}(j, 2)], [0 results{i}(j)], '-k.', ...
tomwalters@54 73 'LineWidth', 1, 'Color', [0.8 0.8 0.8]);
tomwalters@54 74 surf(X, Y, Z, ones(size(Z)) .* (results{i}(j)), 'LineStyle', 'none');
tomwalters@54 75 end
tomwalters@54 76 plot3(spokes{i}(:,1), spokes{i}(:,2), results{i}(:), '-', 'LineWidth', 2, ...
tomwalters@54 77 'Color', [0.2 0.2 0.2]);
tomwalters@54 78 end
tomwalters@54 79 % Plot a zero-sized sphere at zero to get the autoscaling of the colour bar
tomwalters@54 80 % correct
tomwalters@54 81 [X Y Z] = sphere(20);
tomwalters@54 82 X = zeros(size(X)) - 1;
tomwalters@54 83 surf(X, X, X, ones(size(Z)) .* 0, 'LineStyle', 'none');
tomwalters@54 84 %colorbar('WestOutside');
tomwalters@54 85 view([-80 60]);
tomwalters@54 86 grid('on');
tomwalters@54 87 xlim([132 224]);
tomwalters@54 88 zlim([0 100]);
tomwalters@54 89 ylim([10 22]);
tomwalters@54 90 set(gca, 'FontSize', 12);
tomwalters@54 91 %set(gca, 'FontName', 'Hoefler Text');
tomwalters@54 92 xlabel('GPR /Hz');
tomwalters@54 93 ylabel('VTL /cm');
tomwalters@54 94 zlabel('Percent correct');
tomwalters@54 95 set(axes1, 'YScale', 'log');
tomwalters@54 96 set(axes1, 'XScale', 'log');
tomwalters@54 97 set(axes1, 'XTick', [132 172 224]);
tomwalters@54 98 set(axes1, 'YTick', [10 15 22]);
tomwalters@54 99 set(axes1, 'YDir', 'reverse');
tomwalters@54 100 set(axes1, 'ZTick', [0 20 40 60 80 100]);
tomwalters@54 101 hold('all');
tomwalters@54 102 print('-depsc', 'results_plot.eps');
tomwalters@54 103 !open results_plot.eps
tomwalters@54 104
tomwalters@54 105
tomwalters@54 106