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

run image crash [bug] #105

Closed
lizhaohu opened this issue Aug 25, 2020 · 8 comments · May be fixed by #150
Closed

run image crash [bug] #105

lizhaohu opened this issue Aug 25, 2020 · 8 comments · May be fixed by #150

Comments

@lizhaohu
Copy link

lizhaohu commented Aug 25, 2020

Describe the bug
When I run popsift for one image crash,The default parameters are used
my email: [email protected]
popsift_test_crash1

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Log
If applicable, copy paste the relevant log output (please embed the text in a markdown code tag "```" )

Desktop (please complete the following and other pertinent information):

  • OS: [e.g. win 10, osx, ]
  • PopSift version: please specify if you are using a release version or your own build
    • Binary version (if applicable) [e.g. 2019.1]
    • Commit reference (if applicable) [e.g. 08ddbe2]

Additional context
Add any other context about the problem here.

@simogasp
Copy link
Member

are you using popsift-demo? If so can u show the log?

@lizhaohu
Copy link
Author

@simogasp yes, i using popsift-demo, but But I set the config parameter to:
image

and crash at get_descriptor function(sift_pyramid.cu file 317 line).
Before that, I printed out the number of feature points: ext_total: 19558, ori_total: 44599.
The error log:
image

@griwodz
Copy link
Member

griwodz commented Aug 26, 2020

Strange. That error was typical for ext_total==0, but not when ext_total>0. It is possible that the error is actually somewhere else.

Could you enable PopSift_ERRCHK_AFTER_KERNEL in CMake and recompile? That should activate error checking in lines that say POP_SYNC_CHK. Your code will run slower and still crash, but closer to the true origin of the crash.

What is your GPU? Do your CPU and GPU share memory?

@lizhaohu
Copy link
Author

@griwodz ,Thank you for your reply. I've found out the reason. I set _max_extrema to 10000, and when initializing pyramid ,it set dbuf_shadow.desc = malloc(2 * _max_extrema). I extracted 44599 descriptors in this image

@griwodz
Copy link
Member

griwodz commented Aug 26, 2020

@lizhaohu Thanks for finding the reason for the crash.

That is still very strange. In the figure of the Config that you show above, you are setting _max_extrema = 10000, but you have found 19558 (ext_total).

That should not be happening. There is a line:
if( indicator && write_index < d_consts.max_extrema )
in s_extrema.cu:537 that should prevent this from happening.
d_consts.max_extrema is filled by PopSift::configure with the MaxExtrema value from your Config object.

Do you perhaps change the max_extrema to 20000 somewhere else?
That would explain the bug: I did not expect that you could find 125% more descriptors than extrema. Lowe wrote in the original SIFT paper that we could expect about 25% more descriptors than extrema. There is no safety check for the 125% case.

@griwodz
Copy link
Member

griwodz commented Aug 26, 2020

PS: a hotfix to prevent a crash over 100% additional descriptor seems to be simple.
The kernel ori_prefix_sum() in s_orientation.cu (lines 344-345) could compare with d_consts.max_extrema and (2* d_consts.max_extrema) and ignore all extrema and descriptors above the limit.

It would be better, of course, to reallocate memory after that kernel.

@lizhaohu
Copy link
Author

lizhaohu commented Aug 26, 2020

@lizhaohu Thanks for finding the reason for the crash.

That is still very strange. In the figure of the Config that you show above, you are setting _max_extrema = 10000, but you have found 19558 (ext_total).

That should not be happening. There is a line:
if( indicator && write_index < d_consts.max_extrema )
in s_extrema.cu:537 that should prevent this from happening.
d_consts.max_extrema is filled by PopSift::configure with the MaxExtrema value from your Config object.

Do you perhaps change the max_extrema to 20000 somewhere else?
That would explain the bug: I did not expect that you could find 125% more descriptors than extrema. Lowe wrote in the original SIFT paper that we could expect about 25% more descriptors than extrema. There is no safety check for the 125% case.

@griwodz I didn't set max_extrema = 20000 anywhere else. In my understanding, max_extrema means the maximum number of features that can be extracted from each layer of pyramid. So I got that 19558 was the right result

@griwodz In sift_ pyramid.cu file the reallocaxtreme function will be re-malloc the memory

@lizhaohu
Copy link
Author

PS: a hotfix to prevent a crash over 100% additional descriptor seems to be simple.
The kernel ori_prefix_sum() in s_orientation.cu (lines 344-345) could compare with d_consts.max_extrema and (2* d_consts.max_extrema) and ignore all extrema and descriptors above the limit.

It would be better, of course, to reallocate memory after that kernel.

@griwodz Great. Thank you very much

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

Successfully merging a pull request may close this issue.

3 participants