stardist / stardist-napari

StarDist plugin for napari
BSD 3-Clause "New" or "Revised" License
36 stars 11 forks source link

Usage with custom 2D/3D model #25

Open jo-mueller opened 6 months ago

jo-mueller commented 6 months ago

Describe the bug I just tried to use the stardist-napari plugin using a custom model from the bioimage model zoo (i.e., this one). I would expect that I'd just have to select Custom 2D/3D in the stardist-napari plugin and navigate to the model weights (they're downloaded as .h5) and select them. However, the dialogue only allows to select folders and remains red when I chose the folder containing the weights file.

To reproduce Simply install stardist-napari and download the weights from the link above.

Expected behavior Weights should be detectable on my filesystem through the openfiledialogue in the plugin. I suspect that there is an openfolderdialogue instead of an openfiledialogue.

Data and screenshots

Capture

Environment:

os: Windows-10-10.0.19044-SP0
stardist_napari: 2022.12.6
stardist: 0.8.5
csbdeep: 0.7.4
napari: 0.4.19
magicgui: 0.8.2
tensorflow: 2.16.1
jo-mueller commented 6 months ago

Possibly solved by this image.sc thread

uschmidt83 commented 6 months ago

Hi, the plugin expects a folder that contains a (StarDist-specific) config.json file that describes model architecture and at least one .h5 weights file. It looks like the author @qin-yu of the model you mentioned above has chosen to remove the config.json file.

uschmidt83 commented 6 months ago

Sorry, I was remembering this wrong. You actually need to first convert from the bioimage.io format to the "normal" stardist folder format. Then use that folder for the napari plugin. You can see how to do this here.

qin-yu commented 6 months ago

Hey @uschmidt83, should I do something? If I need to fix anything I'll be available over the weekend. If everything is okay then maybe I should put a guide somewhere in the description to show users how to convert. I'll talk to Fynn is there are more generic issues.

uschmidt83 commented 6 months ago

Hi @qin-yu, there's nothing for you to do. The bioimage.io model must be "imported" to create a regular StarDist model folder, as shown in this notebook. It can then be used with the napari plugin. I've also updated the plugin README to document this.