Skip to content
Snippets Groups Projects
Commit 9b15916f authored by Christopher Randolph Rhodes's avatar Christopher Randolph Rhodes
Browse files

More verbose error when matching input and model dimensionality

parent 728b877e
No related branches found
No related tags found
No related merge requests found
......@@ -162,8 +162,15 @@ class IlastikObjectClassifierFromSegmentationModel(IlastikModel, InstanceSegment
return ObjectClassificationWorkflowBinary
def infer(self, input_img: GenericImageDataAccessor, segmentation_img: GenericImageDataAccessor) -> (np.ndarray, dict):
if self.model_chroma != input_img.chroma or self.model_3d != input_img.is_3d():
raise IlastikInputShapeError()
if self.model_chroma != input_img.chroma:
raise IlastikInputShapeError(
f'Model {self} expects {self.model_chroma} input channels but received only {input_img.chroma}'
)
if self.model_3d != input_img.is_3d():
if self.model_3d:
raise IlastikInputShapeError(f'Model is 3D but input image is 2D')
else:
raise IlastikInputShapeError(f'Model is 2D but input image is 3D')
assert segmentation_img.is_mask()
if isinstance(input_img, PatchStack):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment