Skip to content

Commit 2cfdb8c

Browse files
committed
test_output_ref_shape_too_small
1 parent 4117087 commit 2cfdb8c

File tree

4 files changed

+23
-14
lines changed

4 files changed

+23
-14
lines changed

bioimageio/spec/model/v0_5.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def convert_name_to_id(cls, data: Dict[str, Any], info: ValidationInfo):
193193
"name" in data
194194
and "id" not in data
195195
and "original_format" in context
196-
and context["original_format"].release[:2] == (0, 4)
196+
and context["original_format"].release[:2] <= (0, 4)
197197
):
198198
data["id"] = data.pop("name")
199199

example_specs/models/unet2d_nuclei_broad/rdf.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,12 @@ inputs:
4040
- type: batch
4141
- type: channel
4242
channel_names: [raw_intensity]
43+
size: 1
4344
- type: space # todo: scale/unit
44-
name: y
45+
id: y
4546
size: 512
4647
- type: space
47-
name: x
48+
id: x
4849
size: 512
4950
test_tensor: test_input.npy
5051
sample_tensor: test_input.npy
@@ -66,13 +67,14 @@ outputs:
6667
- type: batch
6768
- type: channel
6869
channel_names: [probability]
70+
size: 1
6971
- type: space
70-
name: y
72+
id: y
7173
size: raw.y
7274
halo: 32
7375
- type: space
7476
size: raw.x
75-
name: x
77+
id: x
7678
halo: 32
7779
test_tensor: test_output.npy
7880
sample_tensor: test_output.npy

tests/test_bioimageio_collection.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@
4444
"zero/Notebook_U-Net_3D_ZeroCostDL4Mic/latest/rdf.yaml",
4545
}
4646
KNOWN_INVALID_AS_LATEST = {
47+
"deepimagej/DeepSTORMZeroCostDL4Mic/latest/rdf.yaml",
48+
"deepimagej/Mt3VirtualStaining/latest/rdf.yaml",
49+
"deepimagej/WidefieldDapiSuperResolution/latest/rdf.yaml",
50+
"deepimagej/WidefieldFitcSuperResolution/latest/rdf.yaml",
51+
"deepimagej/DeepSTORMZeroCostDL4Mic/latest/rdf.yaml",
52+
"deepimagej/DeepSTORMZeroCostDL4Mic/latest/rdf.yaml",
53+
"deepimagej/DeepSTORMZeroCostDL4Mic/latest/rdf.yaml",
4754
"10.5281/zenodo.6559929/6559930/rdf.yaml",
4855
"10.5281/zenodo.7380171/7405349/rdf.yaml",
4956
"bioimageio/stardist/latest/rdf.yaml",

tests/test_model/test_v0_5.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ def test_tensor_base_invalid(kwargs: Dict[str, Any]):
124124
"description": "Input 1",
125125
"data": {"type": "float32"},
126126
"axes": [
127-
dict(type="space", name="x", size=10),
128-
dict(type="space", name="y", size=11),
127+
dict(type="space", id="x", size=10),
128+
dict(type="space", id="y", size=11),
129129
dict(type="channel", channel_names=tuple("abc")),
130130
],
131131
"preprocessing": [
@@ -155,7 +155,7 @@ def test_batch_axis(kwargs: Dict[str, Any]):
155155
@pytest.mark.parametrize(
156156
"kwargs",
157157
[
158-
{"type": "space", "name": "x", "size": 10},
158+
{"type": "space", "id": "x", "size": 10},
159159
SpaceInputAxis(id=AxisId("x"), size=10),
160160
{"type": "batch"},
161161
],
@@ -274,17 +274,17 @@ def test_output_fixed_shape_too_small(model_data: Dict[str, Any]):
274274

275275

276276
def test_output_ref_shape_mismatch(model_data: Dict[str, Any]):
277-
model_data["outputs"][0]["axes"][0] = {"type": "space", "name": "x", "size": {"reference": "input_1.x"}, "halo": 2}
277+
model_data["outputs"][0]["axes"][0] = {"type": "space", "id": "x", "size": {"reference": "input_1.x"}, "halo": 2}
278278
summary = validate_format(model_data)
279279
assert summary.status == "passed", summary.format()
280280
# input_1.x -> input_1.z
281-
model_data["outputs"][0]["axes"][0] = {"type": "space", "name": "x", "size": {"reference": "input_1.z"}, "halo": 2}
281+
model_data["outputs"][0]["axes"][0] = {"type": "space", "id": "x", "size": {"reference": "input_1.z"}, "halo": 2}
282282
summary = validate_format(model_data)
283283
assert summary.status == "failed", summary.format()
284284

285285

286286
def test_output_ref_shape_too_small(model_data: Dict[str, Any]):
287-
model_data["outputs"][0]["axes"][0] = {"type": "space", "name": "x", "size": {"reference": "input_1.x"}, "halo": 2}
287+
model_data["outputs"][0]["axes"][0] = {"type": "space", "id": "x", "size": {"reference": "input_1.x"}, "halo": 2}
288288
summary = validate_format(model_data)
289289
assert summary.status == "passed", summary.format()
290290

@@ -301,9 +301,9 @@ def test_model_has_parent_with_id(model_data: Dict[str, Any]):
301301

302302
def test_model_with_expanded_output(model_data: Dict[str, Any]):
303303
model_data["outputs"][0]["axes"] = [
304-
{"type": "space", "name": "x", "size": {"reference": "input_1.x"}},
305-
{"type": "space", "name": "y", "size": {"reference": "input_1.y"}},
306-
{"type": "space", "name": "z", "size": 7},
304+
{"type": "space", "id": "x", "size": {"reference": "input_1.x"}},
305+
{"type": "space", "id": "y", "size": {"reference": "input_1.y"}},
306+
{"type": "space", "id": "z", "size": 7},
307307
{"type": "channel", "size": {"reference": "input_1.channel"}},
308308
]
309309

0 commit comments

Comments
 (0)