matlabopencvimage-processingcascaderoc

How to plot a ROC curve of a detector generated by TrainCascadeObjectDetector?


In my project for object detection in images I use TrainCascadeObjectDetector function of MATLAB you can see also here, this function uses OpenCV to train cascade and is for training a set of images (positives and negatives):

positives: images contain the object of interest.

negatives: images doesn't contain the object of interest but must contain the background of positives for more precision after training.

This function also requires some parameters:

I use the HOG (histogram of oriented gradients), and the result of this function is an .xml file:

trainCascadeObjectDetector(outputXMLFilename,positiveInstances,negativeImages)

I use the output to localize the object of interest in images using:

detector = vision.CascadeObjectDetector(XMLFILE)

so I have in result a detector which I use it to draw bounding boxes:

BBOX = step(detector)

I want to evaluate the performance of my results, I found that is possible to draw a ROC curve, here my question. The ROC is a true positive rate VS false positive rate curve, so it's required value of TPR and FPR. The global TPR and FPR is calculating in this way:

TruePositiveRate^numberOfStages    and FalseAlarmRate^numberOfStages

But they are just 2 values and not able to plot the curve. I tried also to have TPR and FPR by doing a binary comparison from this topic, I did it by comparing my ground truth images and result images and took the max FPR and TPR, Now I have 1 TPR and 1 FPR for the whole images of the final stage. How to get the others from the previous stages?

My GUI: enter image description here


Solution

  • A ROC is defined for parameterized classifiers, where every continuous parameter that influences FPR/TPR has its own curve. You can approximate this curve by repeatedly choosing different values of the parameter, and then running your validation set through your classifier.