Skip to content
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

Core dump on Stereo mode #12

Open
toniomtb opened this issue Apr 27, 2018 · 4 comments
Open

Core dump on Stereo mode #12

toniomtb opened this issue Apr 27, 2018 · 4 comments

Comments

@toniomtb
Copy link

toniomtb commented Apr 27, 2018

Hi,
i've tested the SLAM on GPU in monocular mode and it works very well, but i've found an error in stereo mode.
In file Frame.cc, from line 567 to 571 the code is:

`const int w = 5;

cv::cuda::GpuMat gMat = mpORBextractorLeft->mvImagePyramid[kpL.octave].rowRange(scaledvL - w, scaledvL + w + 1).colRange(scaleduL - w, scaleduL + w + 1);

cv::Mat IL(gMat.rows, gMat.cols, gMat.type(), gMat.data, gMat.step);

IL.convertTo(IL,CV_32F);

IL = IL - IL.at(w,w) *cv::Mat::ones(IL.rows,IL.cols,CV_32F);`

The problem is: the cv::Mat IL is pointing to some address in the gpu, but IL is on the host memory, and it's not possible to reference something in the gpu, this is causing the slam to crash in stereo mode. Same thing happen in lines 586 to 589.

i'm asking for help since i've not yet found a way to fix this problem.
i've tried to download the gMat to the host memory with the cv::cuda::GpuMat::download() function but it's slowing down too much the algorithm, since it makes constant memory transfer from gpu to host. I think that a fix can be to execute all the following operation in gpu and not on cpu.

Thanks for the attention,
Antonio

@yunchih
Copy link
Owner

yunchih commented Apr 27, 2018

Executing following operations on GPU is viable. Do you have a patch?

@toniomtb
Copy link
Author

No, i'm trying to fix this problem but since now i've not found any solution, since i'm not familiar with cuda programming.

@yunchih
Copy link
Owner

yunchih commented Apr 28, 2018

Sorry that I can't roll out a patch for you, either, as I am busy working on other projects. But should anyone also encounter this problem, I'd be appreciative for any patch.

Thanks for reaching.

@connorsoohoo
Copy link

I clocked the time of the Frame::ComputeStereoMatches() function, which looks like the bottleneck here. Because the Mat is being downloaded from the mvImagePyramid GpuMat within the for loop, it takes more than 2 seconds to process this function for each frame. I am trying to execute the following operations using the GPU and just return the norm between the left and right images to the CPU. Has anyone written a custom cuda kernel to perform this task?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants