smallcorgi / Faster-RCNN_TF

Faster-RCNN in Tensorflow
MIT License
2.34k stars 1.12k forks source link

How to draw the Recall-IoU curve? #218

Open hadign20 opened 7 years ago

hadign20 commented 7 years ago

I have tried to draw the Precision-Recall curve in pascal_voc.py like below:

    pl.plot(rec, prec, lw=lw, label = cls)
    pl.xlabel('Recall')
    pl.ylabel('Precision')
    plt.grid(True)
    pl.ylim([0.0, 1.05])
    pl.xlim([0.0, 1.0])
    pl.title('Precision-Recall')
    pl.legend(loc="upper right")     
    plt.show()

This is based on this part of the code which has the variables rec, prec, and ap.

How can I draw the Recall-IoU curve and Recall-NumberOfProposals curve like below? Where can I get the IoU and Number of proposals values?

untitled-3

thanks

seekFire commented 7 years ago

What the location of your code added in pascal_voc.py? In this "for" loop or others? e

seekFire commented 7 years ago

BTW,whether you used the scikit-learn for these code?

Baby47 commented 7 years ago

where can i find the IOU value as is shown in the figure @hadi-ghnd

gustavoneves12 commented 6 years ago

I am using the function below to calculate the recall-iou curve.

I based on: kitti_proposal_eval

function [overlap, recall, AR] = compute_average_recall(iou)
    all_overlaps= sort(iou(:), 'ascend');
    num_pos = numel(all_overlaps);
    dx = 0.001;

    overlap = 0:dx:1;
    overlap(end) = 1;
    recall = zeros(length(overlap), 1);
    for i = 1:length(overlap)
      recall(i) = sum(all_overlaps >= overlap(i)) / num_pos;
    end

    good_recall = recall(overlap > 0.5);
    AR = 2 * dx * trapz(good_recall);
end

% example
[overlaps, recall, ar] = compute_average_recall(iou);
figure;
plot(overlaps, recall, 'LineWidth', 2); 
title(sprintf('AR %.4f', ar), 'FontSize', 16);