Ask Your Question
2

Return confidence factor from detectMultiScale

asked 2013-12-16 03:51:09 -0600

souraklis gravatar image

I am using haarcascade_frontalface detector, for a face detection system. I am trying to find way to return a confidence factor for the detection process. From the parameters of the function I cant locate something about confidence factor. What I ve got to do?

edit retag flag offensive close merge delete

Comments

You have to calculate your own confidence score if you really need it. That means you need to crack up the source code and keep track of your weights and stage confidence factors. You should read the Viola & Jones paper to determine the correct way of calculating the confidence value.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-12-16 04:36:39 -0600 )edit

I ve just have to calculate output y (viola-jones) using the weights from the xml file? Or I ve got to rebuilt opencv in order to keep track of the calculated weights??

souraklis gravatar imagesouraklis ( 2013-12-16 05:25:35 -0600 )edit

Offcourse but you need the prediction rate of each stage, how well the feature got evaluated of a test image using the stored weights/thresholds. It is not that straigtforward.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-12-16 07:07:41 -0600 )edit
1

I ll take a closer look, thanks anyway!!

souraklis gravatar imagesouraklis ( 2013-12-16 07:12:16 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
3

answered 2013-12-17 08:42:30 -0600

updated 2013-12-17 08:50:24 -0600

The detectMultiscale method does not return any confidence factor, however, depending on your application, it might be possible to achieve one without recurring to complex methodologies. If detection is being performed at multiple scales, it is expected that, in some cases, the same object is detected more than once in the same image. So, it is safe to assume that an object detected 2 times has a higher confidence measure than one that was detected one time. In the detectMultiscale method pass the minNeighbours argument as 0 so the algorithm doesn't aggregate any detections.

If you are detecting in sequential frames from a still camera, you can even create your own confidence evaluator algorithm. If the same object is detected multiple times in a number of sequential frames, it is assumed that this object has a higher confidence level, whereas if an object is detected in some frames but not in others, it has a less confidence measure. Be creative.

edit flag offensive delete link more

Comments

2

All of the above is certainly true, but I do think that someone should try to design a metric that can be added to the source code. I find it kind of ridiculous that everyone tries to make his own evaluation function and it never gets added to source code base.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-12-17 09:05:49 -0600 )edit
2

I agree. The CvBoost method, for example, returns a confidence measure in each detection, I don't understand why traincascade doesn't. The most significant measure would be one that is directly correlated to the math that is happening in the algorithm. The suggestion I gave is kind of a band-aid application-dependent solution.

Pedro Batista gravatar imagePedro Batista ( 2013-12-17 09:18:53 -0600 )edit
1

Well as far as I know, using those boost confidence measurements, can be combined in a weighted sum. The further down the chain the higher the weight for that confidence score, since you assume a lot more false features have been eliminated. Maybe something I am going to work on in the future... would definately be an improvement of my own research.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-12-19 08:02:41 -0600 )edit

1.5 years later: was this solved? Is there a way to get confidence levels from Python? :)

angela gravatar imageangela ( 2015-07-16 06:16:02 -0600 )edit

There is an overload function that returns you the last stage score which can be used, found in the parameter levelweights, but it is still not optimal.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-07-18 08:10:48 -0600 )edit

You're right Steven, this form of the function allow to know the confidence level, I use it and it works very well. Do you know if this form of the function has been ported to cuda? It seems, in cuda, that we can not know the confidence level.

dj_benzz gravatar imagedj_benzz ( 2015-10-27 02:42:00 -0600 )edit

It has not been ported. The CUDA implementation of detectMultiScale is quite old and cumbersome and far from updated compared to the current CPU version.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-10-28 04:13:48 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2013-12-16 03:51:09 -0600

Seen: 6,186 times

Last updated: Dec 17 '13