From 7d828e3941f2caa366e9f1f0791c66a028e869b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C2Ramon=20Morros?= Date: Thu, 17 Nov 2016 17:42:15 +0000 Subject: [PATCH] - Minor changes --- compute_results.m | 23 ++++++++++++++--------- evaluation/PerformanceEvaluationWindow.m | 2 +- evaluation/RoiOverlapping.m | 4 ++++ 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/compute_results.m b/compute_results.m index ac5e6a6..90b767c 100644 --- a/compute_results.m +++ b/compute_results.m @@ -4,8 +4,9 @@ addpath(genpath('.')) teams = [1,2,3,4,5,6,7,8]; - week = 1; - window_evaluation = 0; + %teams = [3] + week = 5; + window_evaluation = 1; % Open files to store evaluation results @@ -34,7 +35,7 @@ for kk=3: length(methods), result_files = ListFiles([results_dir, '/', methods(kk).name]); - sprintf ('Method %s : %d files found', size(result_files,1); % This number should be the same as the number of test images + sprintf ('Method %s : %d files found', size(result_files,1)); % This number should be the same as the number of test images for ii=1:size(result_files,1), @@ -56,9 +57,13 @@ if window_evaluation == 1, % Read .mat file [pathstr_r,name_r, ext_r] = fileparts(result_files(ii).name); - mat_name = fullfile(results_dir, methods(kk).name, [name_r '.mat']); + mat_name = fullfile(results_dir, methods(kk).name, [name_r '.mat']); clear windowCandidates load(mat_name); + if size(windowCandidates,2) > 1 && size(windowCandidates,1) == 1, + sprintf('Warning! (team %d): transposed window list', jj); + windowCandidates = windowCandidates'; + end gt_annotations_name = fullfile(test_dir, 'gt', ['gt.' name '.txt']); windowAnnotations = LoadAnnotations(gt_annotations_name); @@ -74,15 +79,15 @@ [pixelPrecision, pixelAccuracy, pixelSpecificity, pixelSensitivity] = PerformanceEvaluationPixel(pixelTP, pixelFP, pixelFN, pixelTN); pixelF1 = 2*((pixelPrecision*pixelSensitivity)/(pixelPrecision + pixelSensitivity)); - fprintf (pixFile, 'Group %02d pixel, method %s : %.2f, %.2f, %.2f\n', teams(jj), methods(kk).name, pixelPrecision, pixelSensitivity, pixelF1); - sprintf ( 'Group %02d pixel, method %s : %.2f, %.2f, %.2f\n', teams(jj), methods(kk).name, pixelPrecision, pixelSensitivity, pixelF1) + fprintf (pixFile, 'Team %02d pixel, method %s : %.2f, %.2f, %.2f\n', teams(jj), methods(kk).name, pixelPrecision, pixelSensitivity, pixelF1); + sprintf ( 'Team %02d pixel, method %s : %.2f, %.2f, %.2f\n', teams(jj), methods(kk).name, pixelPrecision, pixelSensitivity, pixelF1) if window_evaluation == 1, [windowPrecision, windowSensitivity, windowAccuracy] = PerformanceEvaluationWindow(windowTP, windowFN, windowFP); % (Needed after Week 3) - windowF1 =0; + windowF1 = 2*((windowPrecision*windowSensitivity)/(windowPrecision + windowSensitivity)); - fprintf (winFile, 'Group %02d window, method %s : %.2f, %.2f, %.2f\n', teams(jj), methods(kk).name, windowPrecision, windowSensitivity, windowF1); - sprintf ( 'Group %02d window, method %s : %.2f, %.2f, %.2f\n', teams(jj), methods(kk).name, windowPrecision, windowSensitivity, windowF1) + fprintf (winFile, 'Team %02d window, method %s : %.2f, %.2f, %.2f\n', teams(jj), methods(kk).name, windowPrecision, windowSensitivity, windowF1); + sprintf ( 'Team %02d window, method %s : %.2f, %.2f, %.2f\n', teams(jj), methods(kk).name, windowPrecision, windowSensitivity, windowF1) end end end diff --git a/evaluation/PerformanceEvaluationWindow.m b/evaluation/PerformanceEvaluationWindow.m index 6eebae4..2bb6fb8 100644 --- a/evaluation/PerformanceEvaluationWindow.m +++ b/evaluation/PerformanceEvaluationWindow.m @@ -14,6 +14,6 @@ % The function returns the precision, accuracy and sensitivity precision = TP / (TP+FP); % Q: What if i do not have TN? - sensitivity = TP / (TP+FN) + sensitivity = TP / (TP+FN); accuracy = TP / (TP+FN+FP); end diff --git a/evaluation/RoiOverlapping.m b/evaluation/RoiOverlapping.m index 4eed472..2751137 100644 --- a/evaluation/RoiOverlapping.m +++ b/evaluation/RoiOverlapping.m @@ -14,6 +14,10 @@ % The function returns intersection/union for the two windows + %if length(roi01.x) == 0 || length(roi02.x) == 0, + % overlap = 0; + % return + %end % Computing the corners of each roi roi01x1=roi01.x; roi01x2=roi01.x+roi01.w; roi01y1=roi01.y; roi01y2=roi01.y+roi01.h;