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/bioimageio/core.html
MIT License
28 stars 21 forks source link

Prediction for a single block for SAM not working #384

Closed constantinpape closed 7 months ago

constantinpape commented 7 months ago

Minimal reproducible example:

import bioimageio.core
from bioimageio.core.digest_spec import get_test_inputs, get_test_outputs

model_description = bioimageio.core.load_description("diplomatic-bug/staged/1")
inputs = get_test_inputs(model_description)
inputs = inputs.as_single_block()
with bioimageio.core.create_prediction_pipeline(model_description) as pp:
    prediction = pp.predict_sample_block(inputs)

falis with

Traceback (most recent call last):
  File "/home/pape/Work/my_projects/micro-sam/mre_bioio.py", line 9, in <module>
    prediction = pp.predict_sample_block(inputs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pape/Work/bioimageio/core-bioimage-io-python/bioimageio/core/_prediction_pipeline.py", line 124, in predict_sample_block
    output = output_meta.with_data(
             ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pape/Work/bioimageio/core-bioimage-io-python/bioimageio/core/sample.py", line 256, in with_data
    blocks={
           ^
  File "/home/pape/Work/bioimageio/core-bioimage-io-python/bioimageio/core/sample.py", line 257, in <dictcomp>
    m: Block(
       ^^^^^^
  File "<string>", line 9, in __init__
  File "/home/pape/Work/bioimageio/core-bioimage-io-python/bioimageio/core/block.py", line 40, in __post_init__
    assert s == halo.left + (slice_.stop - slice_.start) + halo.right, (
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: (2, SliceInfo(start=0, stop=-1), Halo(left=0, right=0))
FynnBe commented 7 months ago

needs further invesitagion. my guess is that we do not yet correctly handle data dependent axis sizes (data dep axis size is encoded as -1 in some places...)