Home > analysis > WBCanalysis_3.m

WBCanalysis_3

PURPOSE ^

computer and plot out the performance (Recall & Precision) of both

SYNOPSIS ^

function [TPR PPV] = WBCanalysis_3(wbc,SS)

DESCRIPTION ^

computer and plot out the performance (Recall & Precision) of both
positions after detection and after tracking using different parameters.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [TPR PPV] = WBCanalysis_3(wbc,SS)
0002 %computer and plot out the performance (Recall & Precision) of both
0003 %positions after detection and after tracking using different parameters.
0004 
0005 % load _param/_wbc
0006 % load _param/_report
0007 
0008 
0009 P = initParam('wbc');
0010 
0011 TPR = zeros(length(wbc.experiment),1); % Recall
0012 PPV = zeros(length(wbc.experiment),1); % Precision
0013 
0014 
0015 % TPR_TR = zeros(length(wbc),1); % Recall
0016 % PPV_TR = zeros(length(wbc),1); % Precision
0017 
0018 
0019 for exp = 1: length(wbc.experiment)
0020     TPcounter = 0;
0021     FPcounter = 0;
0022     FNcounter = 0;
0023     FN  = zeros(0,5);
0024     FP  = zeros(0,5);
0025     TP  = zeros(0,5);
0026     
0027     % Loop each folder
0028     for seq = 1: length(wbc.experiment(exp).sequence)
0029         % Loop each sub sequence
0030         for s = 1: size(P.IFOLDERS(seq).Ra,1)
0031             % Loop through each frame in a sub sequence
0032             frStart = P.IFOLDERS(seq).Ra(s,1);
0033             frEnd   = P.IFOLDERS(seq).Ra(s,2);
0034             for fr = frStart: frEnd
0035                 % get positions
0036                 gtPositions = round(SS(seq).GT.tracksGT(SS(seq).GT.tracksGT(:,2)==fr,3:4));
0037                 
0038                 if ~isempty(wbc.experiment(exp).sequence(seq).frames)
0039                     dtPositions = wbc.experiment(exp).sequence(seq).frames(wbc.experiment(exp).sequence(seq).frames(:,1)==fr,3:4);
0040                     %                 trPositions = wbc.experiment(exp).sequence(seq).tracks(wbc.experiment(exp).sequence(seq).tracks(:,2)==fr,3:4);
0041                     
0042                     [tpIndex fnIndex fpIndex] = ...
0043                         classify_detection_positions( dtPositions, gtPositions, P.MATCH_DISTANCE);
0044                     
0045                     tpPositions = gtPositions(tpIndex,:);
0046                     tpSeqVector = seq* ones(size(tpPositions,1),1);
0047                     tpFrVector  = fr * ones(size(tpPositions,1),1);
0048                     tpIdVector  = (FPcounter+1 : FPcounter + length(tpIndex))';
0049                     TPcounter = TPcounter + length(tpIndex);
0050                     tp  = horzcat( tpSeqVector, tpFrVector, tpIdVector, tpPositions);
0051                     TP = vertcat( TP , tp);
0052                     
0053                     fnPositions = gtPositions(fnIndex,:);
0054                     fnSeqVector = seq* ones(size(fnPositions,1),1);
0055                     fnFrVector  = fr * ones(size(fnPositions,1),1);
0056                     fnIdVector  = (FNcounter+1 : FNcounter + length(fnIndex))';
0057                     FNcounter = FNcounter + length(fnIndex);
0058                     fn  = horzcat( fnSeqVector, fnFrVector, fnIdVector, fnPositions);
0059                     FN = vertcat( FN , fn);
0060                     
0061                     fpPositions = dtPositions(fpIndex,:);
0062                     fpSeqVector = seq* ones(size(fpPositions,1),1);
0063                     fpFrVector  = fr * ones(size(fpPositions,1),1);
0064                     fpIdVector  = (FPcounter+1 : FPcounter + length(fpIndex))';
0065                     FPcounter = FPcounter + length(fpIndex);
0066                     fp  = horzcat( fpSeqVector, fpFrVector, fpIdVector, fpPositions);
0067                     FP = vertcat( FP , fp);
0068                     
0069                     %                 plotfigure(P.IFOLDERS(seq).Name,fr,'.mn.png', fn ,'FN','y');
0070                     %                 plotfigure(P.IFOLDERS(seq).Name,fr,'.mn.png', fp ,'FP','r');
0071                 else                    
0072                     fnPositions = gtPositions;
0073                     fnSeqVector = seq* ones(size(fnPositions,1),1);
0074                     fnFrVector  = fr * ones(size(fnPositions,1),1);
0075                     fnIdVector  = (FNcounter+1 : FNcounter + size(fnPositions,1))';
0076                     FNcounter = FNcounter  + size(fnPositions,1);
0077                     fn  = horzcat( fnSeqVector, fnFrVector, fnIdVector, fnPositions);
0078                     FN = vertcat( FN , fn);
0079                 end
0080             end
0081         end
0082     end
0083     TPR(exp) = TPcounter / ( TPcounter + FNcounter);
0084     PPV(exp) = TPcounter / ( TPcounter + FPcounter);
0085     
0086     wbc.experiment(exp).TPR = TPR(exp);
0087     wbc.experiment(exp).PPV = PPV(exp);
0088     wbc.experiment(exp).TPcounter  = TPcounter;
0089     wbc.experiment(exp).FPcounter  = FPcounter;
0090     wbc.experiment(exp).FNcounter  = FNcounter;
0091     wbc.experiment(exp).TP  = TP;
0092     wbc.experiment(exp).FN  = FN;
0093     wbc.experiment(exp).FP  = FP;
0094     
0095 end
0096 % save _param/_wbc wbc;
0097 
0098 
0099

Generated on Thu 17-Mar-2011 14:45:51 by m2html © 2005