Skip to content

cuda::createTemplateMatching not work with CUDA10.0 #13477

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dog-fox opened this issue Dec 19, 2018 · 5 comments
Closed

cuda::createTemplateMatching not work with CUDA10.0 #13477

dog-fox opened this issue Dec 19, 2018 · 5 comments
Labels
bug category: gpu/cuda (contrib) OpenCV 4.0+: moved to opencv_contrib
Milestone

Comments

@dog-fox
Copy link

dog-fox commented Dec 19, 2018

System information (version)
- OpenCV => 3.3.1,  3.4.4,  4.0.0
- Operating System / Platform => Jetson Xavier (Ubuntu 18.04, CUDA 10)
- Compiler => g++ 7.3.0
Detailed description

"cuda::createTemplateMatching" not work with CUDA10.0.
Although compiling the program works well, if you execute it,
the process stops while the process is activated.

cv::Ptr<cv::cuda::TemplateMatching> alg;
alg = cv::cuda::createTemplateMatching(templ_h.type(), CV_TM_CCOEFF_NORMED);
alg->match(image_h, templ_h, result);
@nglee
Copy link
Contributor

nglee commented Jan 29, 2019

With CUDA 10.0 on a Pascal GPU(1080 Ti), the problem is not reproduced with this code.

#include <opencv2/opencv.hpp>
#include <cuda_runtime.h>

int main()
{
    cv::cuda::GpuMat image_h(1080, 1920, CV_8UC1);
    cv::cuda::GpuMat templ_h(64, 64, CV_8UC1);
    cv::cuda::GpuMat result(1080-64+1, 1920-64+1, CV_32FC1);

    cv::Ptr<cv::cuda::TemplateMatching> alg;
    alg = cv::cuda::createTemplateMatching(templ_h.type(), CV_TM_CCOEFF_NORMED);
    alg->match(image_h, templ_h, result);

    cudaDeviceSynchronize();
}

Since Jetson Xavier includes a Volta GPU, the problem might be reproducible only on Volta and later architecture. I will test with a Turing GPU as soon as possible.

Tested on 3.4 branch.

@nglee
Copy link
Contributor

nglee commented Jan 29, 2019

Tested with a Turing GPU(2080 Ti) and CUDA 10.0 but the problem is still not reproducible. @dog-fox Could you provide a compilable code that reproduces the behavior?

Tested on 3.4 branch.

@dog-fox
Copy link
Author

dog-fox commented Jan 31, 2019

Hi @nglee ,

Below is my code:
https://devtalk.nvidia.com/default/topic/1046033/jetson-agx-xavier/when-does-jetpack-support-openvx-1-2-/post/5308404/#5308404

thanks.

@nglee
Copy link
Contributor

nglee commented Feb 1, 2019

Hi @dog-fox , thanks for your test code.

The problem seems to be already solved by #13658. After reverting the PR, I was able to reproduce the problem on RTX 2080 Ti, and confirmed that #13658 fixed this issue.

It seems that the reason I wasn't able to reproduce the problem before was because I was testing on the latest 3.4 branch.

Would you please try latest 3.4 or master branch?

@hmzawz2
Copy link

hmzawz2 commented Jul 5, 2019

Hi! I have tried templateMatching in opencv3.4.5 on my computer, which is with cuda10.0 and 2080Ti. I found that the input images must be 32F, and of course the matching method must be changed. But it works! However, I am not quite clear why. Hope this can help you and others!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug category: gpu/cuda (contrib) OpenCV 4.0+: moved to opencv_contrib
Projects
None yet
Development

No branches or pull requests

4 participants