dan@0: function [results] = eventDetectionMetrics_frameBased(outputFile,GTFile) dan@0: dan@0: % Frame-based evaluation for event detection task dan@0: % outputFile: the output of the event detection system dan@0: % GTFile: the ground truth list of events dan@0: dan@0: % Load event list from output and ground-truth dan@0: [onset,offset,classNames] = loadEventsList(outputFile); dan@0: [onsetGT,offsetGT,classNamesGT] = loadEventsList(GTFile); dan@0: dan@0: dan@0: % Convert event list into frame-based representation (10msec resolution) dan@0: [eventRoll] = convertEventListToEventRoll(onset,offset,classNames); dan@0: [eventRollGT] = convertEventListToEventRoll(onsetGT,offsetGT,classNamesGT); dan@0: dan@0: dan@0: % Fix durations of eventRolls dan@0: if (size(eventRollGT,1) > size(eventRoll,1)) eventRoll = [eventRoll; zeros(size(eventRollGT,1)-size(eventRoll,1),16)]; end; dan@0: if (size(eventRoll,1) > size(eventRollGT,1)) eventRollGT = [eventRollGT; zeros(size(eventRoll,1)-size(eventRollGT,1),16)]; end; dan@0: dan@0: dan@0: % Compute frame-based metrics dan@0: Nref = sum(sum(eventRollGT)); dan@0: Ntot = sum(sum(eventRoll)); dan@0: Ntp = sum(sum(eventRoll+eventRollGT > 1)); dan@0: Nfp = sum(sum(eventRoll-eventRollGT > 0)); dan@0: Nfn = sum(sum(eventRollGT-eventRoll > 0)); dan@0: Nsubs = min(Nfp,Nfn); dan@0: dan@0: dan@0: results.Rec = Ntp/(Nref+eps); dan@0: results.Pre = Ntp/(Ntot+eps); dan@0: results.F = 2*((results.Pre*results.Rec)/(results.Pre+results.Rec+eps)); dan@0: results.AEER = (Nfn+Nfp+Nsubs)/(Nref+eps);