Home > tune > threshold_tuning.m

threshold_tuning

PURPOSE ^

% INIT

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

% INIT

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %% INIT
0002 load /wbc/Data/_param/_iFolders;
0003 load /wbc/Data/_param/_report;
0004 
0005 
0006 P = initParam('wbc');
0007 
0008 TPR = zeros(length(P.THR_RM_V),1);
0009 PPV = zeros(length(P.THR_RM_V),1);
0010 
0011 %% Test each threshold
0012 for th = 1: length(P.THR_RM_V)
0013     threshold = P.THR_RM_V(th);
0014     TPcounter = 0;
0015     FPcounter = 0;
0016     FNcounter = 0;
0017     % Loop each folder
0018     for f = 1: 6
0019         % Loop each sub sequence
0020         maskPath = strcat(P.IPATH,'/',iFolders(f).Name,'/amask.png');
0021         mask = imread(maskPath);
0022         for s = 1: size(iFolders(f).Ra,1)
0023             % Loop through each frame in a sub sequence
0024             frStart = iFolders(f).Ra(s,1);
0025             frEnd   = iFolders(f).Ra(s,2);
0026             for fr = frStart: frEnd
0027                 clc; disp(strcat('Processing...dataset_', num2str(f),...
0028                     ' - sequence_',num2str(s),...
0029                     ' - frame_',num2str(fr),...
0030                     ' at threshold_',num2str(threshold),'...'));
0031 
0032                 % get image
0033                 imName = get_im_name(iFolders(f).Name,fr, P.EXTENSION);
0034                 imPath = strcat(P.IPATH,'/',iFolders(f).Name,'/MN/',imName);
0035                 im = imread(imPath);
0036 
0037                 % get positions
0038                 [auPositions imConf]= imdetect(im,mask, P.FILTER_SIZE, P.KERNEL_SIZE, threshold);
0039                 gtPositions = SS(f).Rich.tracksGT(SS(f).Rich.tracksGT(:,2)==fr,3:4);
0040                 gtPositions = round(gtPositions);
0041 
0042                 [tpIndex fnIndex fpIndex] = ...
0043                     classify_detection_positions( auPositions, gtPositions, P.MATCH_DISTANCE);
0044 
0045                 TPcounter = TPcounter + length(tpIndex);
0046                 FNcounter = FNcounter + length(fnIndex);
0047                 FPcounter = FPcounter + length(fpIndex);
0048             end
0049         end
0050     end
0051     TPR(th) = TPcounter / ( TPcounter + FNcounter);
0052     PPV(th) = TPcounter / ( TPcounter + FPcounter);
0053 end

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