Ask Your Question

binbin's profile - activity

2015-08-06 13:06:05 -0600 asked a question GPU/CUDA CascadeClassifier detectMultiScale Slow Performance

I was trying to improve the face detection (HAAR face frontal dataset) performance, so I switched the regular CascadeClassifier::detectMultiScale API to the one under gpu (CUDA) module, and the result is opposite to my expectation.

The video source is a remote HTTP MJPEG stream with 4K resolution, and cudacodec::createVideoReader doesn't seem to support remote protocols, so I had to use regular VideoCapture API to read a Mat object, and then upload it to a GpuMat object.

With the regular parameters(scale factor=1.1, minNeighbors=3), my quad-core i7 3GHz CPU is able to process 4.5 fps, but my GTX 760 is only able to process 1.8 fps.

I remember in HOG detection testing, the CUDA version API runs much faster than CPU one with the same setup. I understand CUDA is not always faster than CPU in different algorithms, but still surprised by this big difference in CascadeClassfier.

So my question is if the GPU CascadeClassifier is still in progress of optimization, or if there is something needed to be declared before using this API, or if it's not possible that GTX760 CUDA will be faster than i7 CPU in this algorithm. My CUDA version is 7.0 and nvidia driver is 346.87. Any advice will be appreciated.

2015-07-30 11:41:16 -0600 commented question Is grayscale image still required in CascadeClassifier::detectMultiScale?

Thanks berak for the answer.

2015-07-30 11:32:39 -0600 asked a question Is grayscale image still required in CascadeClassifier::detectMultiScale?

I noticed that both methods below are working with 'haarcascade_frontalface_alt.xml' dataset. In most tutorial samples they always convert the source frame into grayscale, so my questions is if the conversion will improve either performance or accuracy, or if it is not needed anymore. Thank you.


Mat frame_gray;
cvtColor(frame, frame_gray, CV_BGR2GRAY);
cascade.detectMultiScale(frame_gray, faces, 1.1, 3, 0, Size(50, 50)); // works
 

cascade.detectMultiScale(frame, faces, 1.1, 3, 0, Size(50, 50)); // still works
 
2015-07-30 11:26:09 -0600 received badge  Teacher (source)
2015-07-30 11:13:05 -0600 answered a question opencv import video error python

it should be

cv2.imshow('some', img)

because you are loading the video frame into the variable 'img', and there isn't a variable 'result' ever defined.

2015-07-02 11:04:22 -0600 received badge  Enthusiast
2015-06-30 13:30:28 -0600 received badge  Critic (source)
2015-06-25 16:42:12 -0600 asked a question Stable methods for tracking multiple pedestrians

Hello, I am trying to use HOG/Background Subtractor + Kalman Filter + Hungarian method in order to check the moving direction for every person in a live stream.

In the beginning, I was trying to use the HOG default people detector and use the center coordinate of each detected rectangle to track the movement. But the problem is that the detected rectangle size differs too much in every frame, so those center coordinates are like jumping randomly all the time, which makes very difficult to track their movements.

In addition, there are too many false positives and missed detection in each frame (e.g. I just moved one small step in the camera and HOG can't find me anymore), so false positives seem disrupts the tracking, and missed detection causes losing tracks.

So I switched to use Background Subtractor MOG2 API to grab blobs. But many times it detects my upper body and lower body separately if I am moving slowly. Besides, if I stay in a fixed position for couple of seconds, the API starts to learn myself as a part of background. I put a very high number for the history frames, and also changed different learning rate, but nothing helped.

I have seen a lot of pedestrian tracking demo in youtube, and they all seem very stable and accurate. Any advise to improve my terrible tracking will be appreciated. One of coolest demo for me is using a depth camera to track pedestrians. As far as I know most OpenCV people detectors are based on 2D image, please kindly advise if there is a way to use detectors with the stereo vision in a OpenCV way.

Thank you.

2015-06-19 10:16:14 -0600 received badge  Editor (source)
2015-06-19 10:14:26 -0600 answered a question Program uses too much CPU.. What can be done?

Yes. first you need to compile OpenCV with CUDA enabled. Then you need to write your code with APIs under 'gpu' module, instead of using the generic ones. For my case OpenCV + CUDA reduced my CPU usage a lot for haarCascade face detection, so it should be worthy to try.

2015-05-29 15:39:17 -0600 received badge  Student (source)
2015-05-29 15:38:45 -0600 asked a question OpenCV v3.0 T-API support in Python

Hello,

As far as I know CUDA/OpenCL support is not available in openCV v2.4 with python language.

But, recently I noticed that OpenCV v3 introduced T-API (transparent API), which allows to use either CPU or OpenCL automatically by using the UMat data structure.

So my question is, is there a way to use T-API in python language? or is it already enabled with python by default? Any comment will be appreciated. Many thanks!