Skip to content

Commit

Permalink
refactor: improve naming of bioimageio.core output
Browse files Browse the repository at this point in the history
  • Loading branch information
qin-yu committed Dec 18, 2024
1 parent 6deb8c1 commit f4efde4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions plantseg/functionals/prediction/prediction.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,14 @@ def biio_prediction(
desired_axes = [AxisId(a) for a in ['batch', 'channel', 'z', 'y', 'x']]
t = {i: o.transpose(desired_axes) for i, o in sample_out.members.items()}
named_pmaps = {}
for key, bczyx in t.items():
bczyx = bczyx.data.to_numpy()
for key, tensor_bczyx in t.items():
bczyx = tensor_bczyx.data.to_numpy()
assert bczyx.ndim == 5, f"Expected 5D BCZYX-transposed prediction from `bioimageio.core`, got {bczyx.ndim}D"
for b, czyx in enumerate(bczyx):
named_pmaps[f'{key}_{b}'] = czyx
if bczyx.shape[0] == 1:
named_pmaps[f'{key}'] = bczyx[0]

Check warning on line 103 in plantseg/functionals/prediction/prediction.py

View check run for this annotation

Codecov / codecov/patch

plantseg/functionals/prediction/prediction.py#L93-L103

Added lines #L93 - L103 were not covered by tests
else:
for b, czyx in enumerate(bczyx):
named_pmaps[f'{key}_{b}'] = czyx
return named_pmaps # list of CZYX arrays

Check warning on line 107 in plantseg/functionals/prediction/prediction.py

View check run for this annotation

Codecov / codecov/patch

plantseg/functionals/prediction/prediction.py#L105-L107

Added lines #L105 - L107 were not covered by tests


Expand Down

0 comments on commit f4efde4

Please sign in to comment.