We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
bioimage.io.core.prediction()
To allow the following script to run without errors:
import numpy as np from bioimageio.core.prediction import predict from bioimageio.core.sample import Sample from bioimageio.core.tensor import Tensor from bioimageio.spec.model.v0_5 import TensorId array = np.random.randint(0, 255, (2, 128, 128, 128), dtype=np.uint8) dims = ('c', 'z', 'y', 'x') sample = Sample(members={TensorId('a'): Tensor(array=array, dims=dims)}, stat={}, id='try') temp = predict( model='philosophical-panda', inputs=sample, # `predict()` accepts this input but fails )
The following needs to be fixed:
create_sample_for_model()
None
Temporary solution is to be fully explicit:
from typing import assert_never import numpy as np from bioimageio.core.axis import AxisId from bioimageio.core.prediction import predict from bioimageio.core.sample import Sample from bioimageio.core.tensor import Tensor from bioimageio.spec import load_model_description from bioimageio.spec.model import v0_4, v0_5 from bioimageio.spec.model.v0_5 import TensorId model = load_model_description("philosophical-panda") if isinstance(model, v0_4.ModelDescr): input_ids = [ipt.name for ipt in model.inputs] elif isinstance(model, v0_5.ModelDescr): input_ids = [ipt.id for ipt in model.inputs] else: assert_never(model) assert len(input_ids) == 1 tensor_id = input_ids[0] print("model expects these inputs:", input_ids) array = np.random.randint(0, 255, (2, 128, 128, 128), dtype=np.uint8) dims = ("channel", "z", "y", "x") # FIXME <-- `AxisId` has to be "channel" not "c" sample = Sample( members={ TensorId(tensor_id): Tensor(array=array, dims=dims).transpose( # FIXME <-- `TensorId` has to be specified by user [ AxisId(a) if isinstance(a, str) else a.id for a in model.inputs[0].axes ] # FIXME <-- `AxisId` has to be re-ordered by user ) }, stat={}, id="try", ) temp = predict(model=model, inputs=sample)
The text was updated successfully, but these errors were encountered:
Thanks for summarizing this here, I'll fix it as discusses offline
Sorry, something went wrong.
FynnBe
No branches or pull requests
To allow the following script to run without errors:
The following needs to be fixed:
create_sample_for_model()
should accept an iterable of tensor sourcesNone
is passed to normalisation layers in models"Temporary solution is to be fully explicit:
The text was updated successfully, but these errors were encountered: