Ask Your Question
1

Is cuda::HOG working with cuda::Stream?

asked 2017-02-02 12:13:11 -0600

ClaudioF gravatar image

updated 2017-02-02 15:30:49 -0600

Hi everyone,

I'm trying to use cuda::HOG asynchronously by means of the cuda::Stream.

In particular, I'm trying to use the method compute which seems to provide such capability. Unfortunately, however, when passing a cuda::Stream invoking the function I get the following error:

OpenCV Error: Assertion failed (!stream) in compute, file /tmp/opencv3-20170201-80029-q1jvsi/opencv-3.2.0/modules/cudaobjdetect/src/hog.cpp, line 461

which points to a

CVAssert(!stream)

in the above mentioned hog.cpp file.

Here is a simplified snippet of the code I'm trying to run:

/* Suppose to have: using namespace cv and using namespace cv::cuda*/

Mat      img;
GpuMat   cuda_img;
GpuMat   cuda_img_alpha;
GpuMat   cuda_descriptors;
Stream   stream[10];
Ptr<HOG> cuda_hog_ = HOG::create(Size(320, 240), Size(16, 16), Size(8, 8), Size(8, 8), 9);

for (int i = 0; i < 10; ++i)
{
    ...
    /* I have stored an RGB image in img */

    cuda_img.upload(img, stream[i]);
    cuda::cvtColor(cuda_img, cuda_img_alpha, COLOR_BGR2BGRA, 4, stream[i]);
    cuda_hog->compute(cuda_img_alpha, cuda_descriptors, stream[i]);
}

Everything goes smoothly in both upload and cvtColor, but the assertion is raised within HOG::compute().

Is anyone aware whether it is still an unimplemented feature or I'm doing something wrong?

edit retag flag offensive close merge delete

Comments

I just posted a new issue on GitHub about this, also proposing a possible solution.

ClaudioF gravatar imageClaudioF ( 2017-02-10 06:41:43 -0600 )edit

I submitted a new PR to account for this issue.

ClaudioF gravatar imageClaudioF ( 2017-03-27 04:19:07 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
2

answered 2017-04-03 05:05:47 -0600

ClaudioF gravatar image

Following this merged PR, it is now possible to use cuda::Stream with cuda::HOG compiling and installing the master branch of OpenCV.

Future official release (>3.2) will include this new feature.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-02-02 12:13:11 -0600

Seen: 420 times

Last updated: Apr 03 '17