stardist / stardist

StarDist - Object Detection with Star-convex Shapes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Receptive field measure improvement

etasnadi opened this issue · comments

The _compute_receptive_field function sometimes crashes during prediction with the following error:

ValueError: zero-size array to reduction operation minimum which has no identity.

The issue is that ind can contain empty arrays if y and y0 are the same in line

return [(m-np.min(i), np.max(i)-m) for (m,i) in zip(mid,ind)]
. It should be checked at least to prevent crashes.

Second, since only one point is placed in x to test the receptive field size, it is normal that the prediction stays zero if a model is properly trained on larger objects. It would be better to run this function prior loading the weights because it would have a higher change of not predicting zero output for a single test pixel.

I can make a pull request if anybody is interested in the fix.

#182

Hi @etasnadi, thanks for raising this issue. Sorry that it took so long to reply. I hope that 370d99b fixes the issue.