comparison functions/challange/eventDetectionMetrics_frameBased.m @ 0:2fadb31a9d55 tip

Import code by Vuegen et al
author Dan Stowell <dan.stowell@elec.qmul.ac.uk>
date Fri, 11 Oct 2013 12:02:43 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:2fadb31a9d55
1 function [results] = eventDetectionMetrics_frameBased(outputFile,GTFile)
2
3 % Frame-based evaluation for event detection task
4 % outputFile: the output of the event detection system
5 % GTFile: the ground truth list of events
6
7 % Load event list from output and ground-truth
8 [onset,offset,classNames] = loadEventsList(outputFile);
9 [onsetGT,offsetGT,classNamesGT] = loadEventsList(GTFile);
10
11
12 % Convert event list into frame-based representation (10msec resolution)
13 [eventRoll] = convertEventListToEventRoll(onset,offset,classNames);
14 [eventRollGT] = convertEventListToEventRoll(onsetGT,offsetGT,classNamesGT);
15
16
17 % Fix durations of eventRolls
18 if (size(eventRollGT,1) > size(eventRoll,1)) eventRoll = [eventRoll; zeros(size(eventRollGT,1)-size(eventRoll,1),16)]; end;
19 if (size(eventRoll,1) > size(eventRollGT,1)) eventRollGT = [eventRollGT; zeros(size(eventRoll,1)-size(eventRollGT,1),16)]; end;
20
21
22 % Compute frame-based metrics
23 Nref = sum(sum(eventRollGT));
24 Ntot = sum(sum(eventRoll));
25 Ntp = sum(sum(eventRoll+eventRollGT > 1));
26 Nfp = sum(sum(eventRoll-eventRollGT > 0));
27 Nfn = sum(sum(eventRollGT-eventRoll > 0));
28 Nsubs = min(Nfp,Nfn);
29
30
31 results.Rec = Ntp/(Nref+eps);
32 results.Pre = Ntp/(Ntot+eps);
33 results.F = 2*((results.Pre*results.Rec)/(results.Pre+results.Rec+eps));
34 results.AEER = (Nfn+Nfp+Nsubs)/(Nref+eps);