Face Detection is not detected using detectMultiScale when GPU is enabled

asked 2019-10-24 23:10:52 -0500

updated 2019-10-28 08:03:54 -0500

supra56 gravatar image

Installed Packages

Operating System -> Ubuntu 18.04

NVIDIA Driver -> Tesla Driver for Ubuntu 18.04 Version: 418.87.00

CUDA -> CUDA Toolkit 10.1

CuDNN -> CuDNN 7.6

CMake -> 3.15.2

OpenCV -> 3.4.1

Caffe -> 1.0.0

Tensorflow-GPU -> 1.4.0

GPU -> Tesla T4

Issue while Executing Application

In CPU Mode

When we disable GPU Mode and run through CPU Mode the face detection is working ..

int flag = CV_HAAR_DO_ROUGH_SEARCH|CV_HAAR_SCALE_IMAGE; this->face_detector_cpu.detectMultiScale(gray, faces_tmp, 1.2, 1, flag, cv::Size(param.minFaceSize, param.minFaceSize), cv::Size(param.maxFaceSize, param.maxFaceSize));

FPS: Face Detection is detecting with less FPS

In GPU Mode

When we disable the GPU mode and executing our Application the face detection is working fine

But if we enable the GPU mode the face detection is not working its getting freezed in detectMultiScale function

The following is the code for the reference

FaceDetector::getInstance().detect(frame, faces_haar, faceParam, FaceDetectionType == "HAAR",  enable_gpu, scale);

this->face_detector_gpu->detectMultiScale(im_gpu, faces_gpu);
edit retag flag offensive close merge delete

Comments

  • you cannot use the same xml cascade file for cpu and gpu, you need special xml files for gpu

  • 3.4.1 is one of the last versions, that have cuda support for cascades, it's a dead end. no more in current opencv.

  • please have a look at alternative cnn based face detectors, they're much faster and better supported.

berak gravatar imageberak ( 2019-10-25 00:50:20 -0500 )edit