Skip to content

Commit db97e65

Browse files
Merge pull request #230 from bioimage-io/remove-enforce-min-shape
Remove enforce min shape
2 parents ab8ef2e + a3834f4 commit db97e65

File tree

2 files changed

+1
-28
lines changed

2 files changed

+1
-28
lines changed

bioimageio/core/prediction_pipeline/_prediction_pipeline.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -146,33 +146,6 @@ def unload(self):
146146
self._model.unload()
147147

148148

149-
def enforce_min_shape(min_shape, step, axes):
150-
"""Hack: pick a bigger shape than min shape
151-
152-
Some models come with super tiny minimal shapes, that make the processing
153-
too slow. While dryrun is not implemented, we'll "guess" a sensible shape
154-
and hope it will fit into memory.
155-
156-
"""
157-
MIN_SIZE_2D = 256
158-
MIN_SIZE_3D = 64
159-
160-
assert len(min_shape) == len(step) == len(axes)
161-
162-
spacial_increments = sum(i != 0 for i, a in zip(step, axes) if a in "xyz")
163-
if spacial_increments > 2:
164-
target_size = MIN_SIZE_3D
165-
else:
166-
target_size = MIN_SIZE_2D
167-
168-
factors = [math.ceil((target_size - s) / i) for s, i, a in zip(min_shape, step, axes) if a in "xyz"]
169-
if sum(f > 0 for f in factors) == 0:
170-
return min_shape
171-
172-
m = max(factors)
173-
return [s + i * m for s, i in zip(min_shape, step)]
174-
175-
176149
def create_prediction_pipeline(
177150
*, bioimageio_model: nodes.Model, devices: Optional[Sequence[str]] = None, weight_format: Optional[str] = None
178151
) -> PredictionPipeline:

dev/environment-torch.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ channels:
44
- defaults
55
dependencies:
66
- black
7-
- bioimageio.spec
7+
- bioimageio.spec >=0.4.4
88
- conda-build
99
- h5py >=2.10,<2.11
1010
- mypy

0 commit comments

Comments
 (0)