bioimage-io / core-bioimage-io-python

Python libraries for loading, running and packaging bioimage.io models
https://bioimage-io.github.io/core-bioimage-io-python/
MIT License
28 stars 21 forks source link

How to run 'powerful-fish' on my image? #405

Open tibuch opened 3 months ago

tibuch commented 3 months ago

Hi everyone,

I wanted to try one of the available models to enhance membranes in one of my images. The image is 3D with shape = (91, 1024, 1024). I tried to use the CLI with bioimageio predict-image but I get an ERROR: Could not consume arg: predict-image.

Then I thought to try it via Python, but I encounter this:

prediction_pipeline.predict_sample_with_blocking(sample)
---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
Cell In[85], line 1
----> 1 prediction_pipeline.predict_sample_with_blocking(sample)

File ~/Gitrepos/gliberal_crypt-morphogenisis/.pixi/envs/modelzoo/lib/python3.12/site-packages/bioimageio/core/_prediction_pipeline.py:200, in PredictionPipeline.predict_sample_with_blocking(self, sample, skip_preprocessing, skip_postprocessing, ns, batch_size)
    197     self.apply_preprocessing(sample)
    199 if isinstance(self.model_description, v0_4.ModelDescr):
--> 200     raise NotImplementedError(
    201         "predict with blocking not implemented for v0_4.ModelDescr {self.model_description.name}"
    202     )
    204 ns = ns or self._default_ns
    205 if isinstance(ns, int):

NotImplementedError: predict with blocking not implemented for v0_4.ModelDescr {self.model_description.name}

What is the recommended way to run tiled prediction with a v0.4 model?

esgomezm commented 3 months ago

Hi Tim!

The issue is basically that we cannot perform tiling with the new version of bioimageio.core library on "old models" (with a format version < 0.5).

For simply testing the inference, I would recommend using the test run online in the website. It will do the tiling and it's straightforward to drag&drop the image and click on run model. I would reduce slightly the Z-dimension from 91 to 64 and if possible the (X,Y) dimensions. If not, it will just take more time.

Screenshot 2024-07-22 at 13 41 37

Otherwise, to use the Python code, here are some alternatives:

I hope this helps. Please, let us know how it goes

FynnBe commented 3 months ago

Hi @tibuch I'm currently working on restoring some of the convenience functionality from before the update of bioimageio.spec (and its incorporation into bioimageio.core): #406 So this should become more accessible in the next release.