Ask Your Question

CascadeClassifier_GPU NCV Assertion Failed

asked 2013-12-18 09:33:59 -0500

Nixer gravatar image

Hello, I'm trying to use Haar cascade classifier on GPU

gpu::CascadeClassifier_GPU ccG;
if (ccG.load(cascadeFileName))
gpu::GpuMat imGPU, objsGPU;
int detections_number = ccG.detectMultiScale(imGPU, objsGPU, 1.05, 0, cv::Size(32, 32));

CascadeClassifier_GPU loads from file, but I have an exception on detectMultiScale.

OpenCV Error: Gpu API call (NCV Assertion Failed: NcvStat=28, file=......\modules\gpu\src\cascadeclassifier.cpp, line=117) in unknown function, file ......\modules\gpu\src\cascadeclassifier.cpp, line 131

As I can understand 28 means NCV_WARNING_HAAR_DETECTIONS_VECTOR_OVERFLOW. Does it mean that I can't use my cascade file to run detection on GPU.

P.S. CPU CascadeDetector can do detectMultiScale.

edit retag flag offensive close merge delete


How did you found out that NcvStat=28 meant NCV_WARNING_HAARDETECTIONS_VECTOR_OVERFLOW?

PatriciaNavarro gravatar imagePatriciaNavarro ( 2017-04-23 11:53:59 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2013-12-20 09:44:00 -0500

Nixer gravatar image

I found out what was happening. When I passed empty objsGPU to detectMultiScale than it will allocate place for 100 detections:

const int defaultObjSearchNum = 100;
if (objectsBuf.empty())
    objectsBuf.create(1, defaultObjSearchNum, DataType<Rect>::type);

And further if number of detection more than allocated then assertion described above happens. So if I allocate memory for detections

objsGPU.create(1, 10000, cv::DataType<cv::Rect>::type);

everything will work

edit flag offensive delete link more
Login/Signup to Answer

Question Tools


Asked: 2013-12-18 09:33:59 -0500

Seen: 1,007 times

Last updated: Dec 20 '13