-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New predict command: tiled prediction not working for model v0.4 #415
Comments
Yes, blocking is not implemented for model 0.4. import collections.abc
from typing import Any
import imageio.v3 as imageio
from xarray import DataArray
import bioimageio.core
import bioimageio.spec
from bioimageio.spec.model.v0_5 import AxisId, NDArray
model = bioimageio.core.load_model("hiding-tiger", format_version="0.5")
assert isinstance(model, bioimageio.spec.model.v0_5.ModelDescr)
assert not isinstance(model.inputs[0].data, collections.abc.Sequence)
# input data type should be float32 now (after updating hiding-tiger to version 1.1)
print(model.inputs[0].data.type)
input_descr = model.inputs[0]
image: NDArray[Any] = imageio.imread(
"/home/pape/.cache/micro_sam/sample_data/livecell-2d-image.png"
)
# this still does not work for me! (It would be great to fix it)
# inputs = {input_descr.id: DataArray(image[None, None], dims=tuple(input_descr.axes))}
# -> fix:
inputs = {
input_descr.id: DataArray(
image[None, None],
dims=tuple(a.id for a in input_descr.axes), # use id of every axis
)
}
# alternative:
# inputs = bioimageio.core.digest_spec.load_sample_for_model(
# model=model,
# paths={model.inputs[0].id: Path("image path")},
# )
# tile_shape = {"y": 512, "x": 512}
tile_shape = {input_descr.id: {AxisId("x"): 512, AxisId("y"): 512}}
pred = bioimageio.core.predict(model=model, inputs=inputs, input_block_shape=tile_shape) |
The model conversion does not work for me (which is a separate issue tied to the changes you made for this model, see message in the chat) |
fixed |
Tiled prediction seems to not be implemented for v0.4 models:
fails with
The text was updated successfully, but these errors were encountered: