Different results of CascadeClasifier on CPU and GPU

asked 2016-06-14 12:31:05 -0500

Raymondo gravatar image

updated 2016-06-16 02:13:23 -0500

I built the latest OpenCV version with cuda support from master branch. After that I tried to use CPU cv::CascadeClassifier and GPU cv::cuda::CascadeClassifier, but faced with a strange result. I use same xml from opencv/data/haarcascades_cuda/haarcascade_fullbody.xml for both CPU and GPU version of CascadeClassifier. CPU Classifier with this xml shows much more objects than GPU classifier.

What I need to do to get equal result?

Another strange thing, that when I set ScaleFactor to 2, speed of CPU version boosted up to 4 times, but GPU version becomes just slightly faster.

My system - Ubuntu 14.04 x64, Video card is GTX-950, Video driver v.352.93

Demonstration project: https://bitbucket.org/barbatum/cascadeqa

edit retag flag offensive close merge delete


First the parameters scaleFactor and minNeighbors are not the same by default between CPU and GPU.

Second, the two implementations are different. Also the GPU architecture is different to the CPU one that leads to different ways to program.

Additional information here.

If you want to detect pedestrian, you may consider using HoG detection or this one: C4-Real-time-pedestrian-detection instead.

Eduardo gravatar imageEduardo ( 2016-06-18 08:29:06 -0500 )edit

Hello @Eduardo, thanks for answer!

I changed this parameters to same values and now I see more detections on GPU, but still much less than on CPU. New video demonstration here: https://github.com/Itseez/opencv/file...

Sorry, but I need to detect not only humans and preferably on GPU because of performance reasons, therefore I want to use Haar method.

Raymondo gravatar imageRaymondo ( 2016-06-19 12:54:14 -0500 )edit