Skip to content

Commit 2bcb6eb

Browse files
Use the correct model
1 parent d1c3cbb commit 2bcb6eb

File tree

1 file changed

+27
-70
lines changed

1 file changed

+27
-70
lines changed

example/bioimageio-core-usage.ipynb

Lines changed: 27 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
},
1111
{
1212
"cell_type": "code",
13-
"execution_count": 1,
13+
"execution_count": null,
1414
"id": "c72ba149",
1515
"metadata": {},
1616
"outputs": [],
@@ -29,7 +29,7 @@
2929
},
3030
{
3131
"cell_type": "code",
32-
"execution_count": 2,
32+
"execution_count": null,
3333
"id": "74613461",
3434
"metadata": {},
3535
"outputs": [],
@@ -52,43 +52,43 @@
5252
},
5353
{
5454
"cell_type": "code",
55-
"execution_count": 3,
55+
"execution_count": null,
5656
"id": "2de51dae",
5757
"metadata": {},
5858
"outputs": [],
5959
"source": [
60-
"# rdf_url = \"https://sandbox.zenodo.org/record/881989/files/rdf.yaml\"\n",
61-
"rdf_url = \"https://sandbox.zenodo.org/record/881989/files/rdf.yaml?download=1\"\n",
62-
"rdf_doi = \"10.5072/zenodo.881940\"\n",
60+
"rdf_url = \"https://sandbox.zenodo.org/record/933830/files/rdf.yaml\"\n",
61+
"\n",
62+
"rdf_doi = \"10.5072/zenodo.933830\"\n",
63+
"\n",
6364
"rdf_path = \"/home/pape/Downloads/dsb-nuclei-boundarymodelnew_pytorch_state_dict.zip\""
6465
]
6566
},
6667
{
6768
"cell_type": "code",
68-
"execution_count": 4,
69+
"execution_count": null,
6970
"id": "ce884f8c",
7071
"metadata": {},
7172
"outputs": [],
7273
"source": [
7374
"# load model from link to rdf.yaml\n",
74-
"# TODO does not work yet\n",
75-
"# model_resource = bioimageio.core.load_resource_description(rdf_url)"
75+
"model_resource = bioimageio.core.load_resource_description(rdf_url)"
7676
]
7777
},
7878
{
7979
"cell_type": "code",
80-
"execution_count": 5,
80+
"execution_count": null,
8181
"id": "c1230b2d",
8282
"metadata": {},
8383
"outputs": [],
8484
"source": [
85-
"# TODO does not work yet\n",
86-
"# model_resource = bioimageio.core.load_resource_description(rdf_doi)"
85+
"# load model from doi\n",
86+
"model_resource = bioimageio.core.load_resource_description(rdf_doi)"
8787
]
8888
},
8989
{
9090
"cell_type": "code",
91-
"execution_count": 6,
91+
"execution_count": null,
9292
"id": "8329315c",
9393
"metadata": {},
9494
"outputs": [],
@@ -108,7 +108,7 @@
108108
},
109109
{
110110
"cell_type": "code",
111-
"execution_count": 8,
111+
"execution_count": null,
112112
"id": "f59b1b15",
113113
"metadata": {},
114114
"outputs": [],
@@ -118,7 +118,7 @@
118118
},
119119
{
120120
"cell_type": "code",
121-
"execution_count": 9,
121+
"execution_count": null,
122122
"id": "808e2ca7",
123123
"metadata": {},
124124
"outputs": [],
@@ -139,27 +139,18 @@
139139
},
140140
{
141141
"cell_type": "code",
142-
"execution_count": 10,
142+
"execution_count": null,
143143
"id": "4f235e9a",
144144
"metadata": {},
145-
"outputs": [
146-
{
147-
"name": "stderr",
148-
"output_type": "stream",
149-
"text": [
150-
"/home/pape/Work/software/conda/miniconda3/envs/bio-core-dev/lib/python3.7/site-packages/torch/nn/functional.py:718: UserWarning: Named tensors and all their associated APIs are an experimental feature and subject to change. Please do not use them for anything important until they are released as stable. (Triggered internally at /tmp/pip-req-build-xi8rb33b/c10/core/TensorImpl.h:1156.)\n",
151-
" return torch.max_pool2d(input, kernel_size, stride, padding, dilation, ceil_mode)\n"
152-
]
153-
}
154-
],
145+
"outputs": [],
155146
"source": [
156147
"prediction = predict_numpy(model_resource, input_image)\n",
157148
"show_images(input_image, prediction, names=[\"image\", \"prediction\"])"
158149
]
159150
},
160151
{
161152
"cell_type": "code",
162-
"execution_count": 11,
153+
"execution_count": null,
163154
"id": "58f6c459",
164155
"metadata": {},
165156
"outputs": [],
@@ -178,7 +169,7 @@
178169
},
179170
{
180171
"cell_type": "code",
181-
"execution_count": 12,
172+
"execution_count": null,
182173
"id": "879618df",
183174
"metadata": {},
184175
"outputs": [],
@@ -198,18 +189,10 @@
198189
},
199190
{
200191
"cell_type": "code",
201-
"execution_count": 13,
192+
"execution_count": null,
202193
"id": "5962d73a",
203194
"metadata": {},
204-
"outputs": [
205-
{
206-
"name": "stderr",
207-
"output_type": "stream",
208-
"text": [
209-
"invalid local relative path: documentation.md\n"
210-
]
211-
}
212-
],
195+
"outputs": [],
213196
"source": [
214197
"# create a new model with different post-processing\n",
215198
"from bioimageio.core.build_spec import build_model\n",
@@ -265,7 +248,7 @@
265248
},
266249
{
267250
"cell_type": "code",
268-
"execution_count": 14,
251+
"execution_count": null,
269252
"id": "e0616547",
270253
"metadata": {},
271254
"outputs": [],
@@ -285,18 +268,10 @@
285268
},
286269
{
287270
"cell_type": "code",
288-
"execution_count": 16,
271+
"execution_count": null,
289272
"id": "482a64bb",
290273
"metadata": {},
291-
"outputs": [
292-
{
293-
"name": "stderr",
294-
"output_type": "stream",
295-
"text": [
296-
"invalid local relative path: ./documentation.md\n"
297-
]
298-
}
299-
],
274+
"outputs": [],
300275
"source": [
301276
"from bioimageio.core.weight_converter.torch import convert_weights_to_pytorch_script\n",
302277
"from bioimageio.core.build_spec import add_weights\n",
@@ -309,7 +284,7 @@
309284
},
310285
{
311286
"cell_type": "code",
312-
"execution_count": 17,
287+
"execution_count": null,
313288
"id": "b15dd990",
314289
"metadata": {},
315290
"outputs": [],
@@ -321,28 +296,10 @@
321296
},
322297
{
323298
"cell_type": "code",
324-
"execution_count": 18,
299+
"execution_count": null,
325300
"id": "2aa9db23",
326301
"metadata": {},
327-
"outputs": [
328-
{
329-
"name": "stderr",
330-
"output_type": "stream",
331-
"text": [
332-
"invalid local relative path: ./documentation.md\n"
333-
]
334-
},
335-
{
336-
"data": {
337-
"text/plain": [
338-
"'another_model.zip'"
339-
]
340-
},
341-
"execution_count": 18,
342-
"metadata": {},
343-
"output_type": "execute_result"
344-
}
345-
],
302+
"outputs": [],
346303
"source": [
347304
"# saving model packages\n",
348305
"bioimageio.core.export_resource_package(new_model2_raw, output_path=\"another_model.zip\")"

0 commit comments

Comments
 (0)