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

NMS start suppressing crashes #195

Open
usmanqureshi94 opened this issue May 17, 2022 · 7 comments
Open

NMS start suppressing crashes #195

usmanqureshi94 opened this issue May 17, 2022 · 7 comments
Labels
bug Something isn't working

Comments

@usmanqureshi94
Copy link

Describe the bug
I have a small tile, for which startdist detects about a 0.7million points or n_polys. In nms start suppressing step, the program crashes after hanging the system for a while. I understand it's very unusual to have so many points in such a small tile but how can I overcome this issue of stardist crashing.

To reproduce
I've attached the image to reproduce the issue with a pre-trained model.

test_nms

@usmanqureshi94 usmanqureshi94 added the bug Something isn't working label May 17, 2022
@usmanqureshi94
Copy link
Author

image

@uschmidt83
Copy link
Member

Sorry for the late reply.

I've attached the image to reproduce the issue with a pre-trained model.

Can you please be more specific how to reproduce this issue?

@usmanqureshi94
Copy link
Author

No worries, if you download the above image and just call stardist's predict method. it finds about 700k potential points at first and gets stuck in nms loop.

@uschmidt83
Copy link
Member

I guess you mean the predict_instances method that includes the NMS loop. Which model are you using?

@usmanqureshi94
Copy link
Author

I tested with both pretrained stardist 2d model and custom model 2d model. Whenever points are more than 500k the execution gets stuck in the NMS loop. I tested with 8 core and 32 core CPU but the execution never terminates.

@uschmidt83
Copy link
Member

uschmidt83 commented Jun 8, 2022

Your image is mostly just white, hence not suitable for any of our pre-trained models (which expect a black background).

I did the prediction with our 2D_versatile_fluo model, and the probability image is almost 0 everyhere, i.e. no objects would've been predicted. I strongly suspect you didn't normalize your image before prediction (e.g. try model.predict_instances(img/255)).

@usmanqureshi94
Copy link
Author

thanks this resolved the issue. I was using csbdeep's normalize function as per example notebook
img_gray_slice = normalize(img_gray_slice, 1, 99.8, axis=cfg.AXIS_NORM)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants