python - Plotting ROC curves for viola-jones results -


i have measure results face detector, example, , found on articles viola-jones 1 used statistical curve used measure roc curve. can't find way plot roc curve on gnu/linux, in matlab not buy use plotroc function.

i searched on octave not find it... there way plot 1 roc curve? using python example...?

i measure true positives against false positives, example.

hope helps, plots roc curve using face data, non face data

function thresh = computeroc( cparams, fdata, nfdata ) %function computeroc compute roc curve      face_fnames = dir(fdata.dirname);     full_face = 3:length(face_fnames);     test_face = setdiff(full_face, fdata.fnums);     num_tf = size(test_face,2);      nface_fnames = dir(nfdata.dirname);     full_nface = 3:length(nface_fnames);     test_nface = setdiff(full_nface, nfdata.fnums);     num_tnf = size(test_nface,2);      scores = zeros(num_tf+num_tnf, 2);      ii = 1:num_tf         im_fname = [fdata.dirname, '/', face_fnames(test_face(ii)).name];         [~, ii_im] = loadim(im_fname);         sc = applydetector(cparams, ii_im);         scores(ii,1) = sc;         scores(ii,2) = 1;     end      ii = 1:num_tnf         im_fname = [nfdata.dirname, '/', nface_fnames(test_nface(ii)).name];         [~, ii_im] = loadim(im_fname);         sc = applydetector(cparams, ii_im);         scores(ii+num_tf,1) = sc;         scores(ii+num_tf,2) = 0;     end      thresh = 0;      threshold = 0:0.01:max(scores(:,1));     fpr = zeros(size(threshold));     tpr = zeros(size(threshold));      tt=1:length(threshold)         ntp = 0; nfp = 0; ntn = 0; nfn = 0;         predicted_class = scores(:, 1) >= threshold(tt);         ii=1:size(predicted_class, 1)             if predicted_class(ii) == 1 && scores(ii, 2) == 1                 ntp = ntp+1;             elseif predicted_class(ii) == 0 && scores(ii, 2) == 0                 ntn = ntn+1;             elseif predicted_class(ii) == 1 && scores(ii, 2) == 0                 nfp = nfp+1;             elseif predicted_class(ii) == 0 && scores(ii, 2) == 1                 nfn = nfn+1;             end         end          fpr(tt) = nfp / double(ntn+nfp);         tpr(tt) = ntp / double(ntp+nfn);          if tpr(tt) > 0.7             thresh = threshold(tt);         end     end      figure; plot(fpr, tpr, 'r-');  end 

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -