stardist / stardist

StarDist - Object Detection with Star-convex Shapes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NMS start suppressing crashes

usmanqureshi94 opened this issue · comments

commented

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

commented

image

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?

commented

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.

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

commented

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.

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)).

commented

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)