You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For CV_CUDEV_ARCH > =300, CUDA implementation should instead use texture objects. This already has been implemented in opencv_contrib but for a different algorithm. Specifically, cv::cuda::createCannyEdgeDetector in this commit : 6ca24c8
I already have an implementation which solves this problem for cv::cuda::HoughSegmentDetector() based on cv::cuda::createCannyEdgeDetector() implementation.
I will submit a PR with this solution shortly.
System information (version)
OpenCV => 4.5.5-dev
Operating System / Platform => Ubuntu 18.04
Compiler => gcc
Detailed description
See above.
Code to reproduce
This code launches 5 threads and each executes probabilistic hough segment detector on a sample image 1000 times.
When two threads are trying to access the texture reference (which behaves similar to global memory), the code crashes.
root@df29f8235b3a:/src/testdata# ./hough_crash_reproduce
Test case for hough segmentation cuda crash...
Reading test image...
Test image reading successful.
Thread, 4, index, 0,Found #lines, 4096
Thread, 3, index, 0,Found #lines, 4096
Thread, 1, index, 0,Found #lines, 4096
Thread, 0, index, 0,Found #lines, 4096
...
Thread, 4, index, 21,Found #lines, 4096
terminate called after throwing an instance of 'cv::Exception'
what(): OpenCV(4.5.3) /opencv_contrib-4.5.3/modules/cudaimgproc/src/cuda/hough_segments.cu:234: error: (-217:Gpu API call) an illegal memory access was encountered in function 'houghLinesProbabilistic_gpu'
terminate called recursively
terminate called recursively
Aborted (core dumped)
I'm attaching the test image that was used to reproduce the crash. However, any image can be used to reproduce this bug.
Issue submission checklist
I report the issue, it's not a question
I checked the problem with documentation, FAQ, open issues,
forum.opencv.org, Stack Overflow, etc and have not found any solution
I updated to the latest OpenCV version and the issue is still there
There is reproducer code and related data files: videos, images, onnx, etc
The text was updated successfully, but these errors were encountered:
cv::cuda::HoughSegmentDetector
crashes when used in multiple threads because it uses texture reference.A texture reference is similar to global memory which is not thread-safe.
The current implementation of HoughSegmentDetector uses texture reference. See here :
opencv_contrib/modules/cudaimgproc/src/cuda/hough_segments.cu
Line 52 in a5b2490
For
CV_CUDEV_ARCH > =300
, CUDA implementation should instead use texture objects. This already has been implemented inopencv_contrib
but for a different algorithm. Specifically, cv::cuda::createCannyEdgeDetector in this commit : 6ca24c8I already have an implementation which solves this problem for
cv::cuda::HoughSegmentDetector()
based oncv::cuda::createCannyEdgeDetector()
implementation.I will submit a PR with this solution shortly.
System information (version)
Detailed description
See above.
Code to reproduce
This code launches 5 threads and each executes probabilistic hough segment detector on a sample image 1000 times.
When two threads are trying to access the texture reference (which behaves similar to global memory), the code crashes.
Here's the crash log.
I'm attaching the test image that was used to reproduce the crash. However, any image can be used to reproduce this bug.

Issue submission checklist
forum.opencv.org, Stack Overflow, etc and have not found any solution
The text was updated successfully, but these errors were encountered: