Skip to content

Commit 40a9865

Browse files
committed
fix: modify example notebooks inference
1 parent 351c232 commit 40a9865

11 files changed

+9
-431
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
## Features
2+
- Add option for mixed precision inference
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## Features
2+
- Add support for `.geojson`, `.feather`, `.parquet` file formats when running inference.
3+
4+
## Style
5+
- Update the `Ìnferer.infer()` -method api to accept arguments related to saving the model outputs.

examples/lizard_nuclei_segmentation_cellpose.ipynb

Lines changed: 0 additions & 414 deletions
This file was deleted.

examples/pannuke_cellpose_benchmark.ipynb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@
6767
" resize=(256, 256), # not actually resizing anything\n",
6868
" instance_postproc=\"cellpose\",\n",
6969
" normalization=\"minmax\", # minmax normalization was used for training\n",
70-
" save_intermediate=True # this needs to be set to True for latency benchmarks.\n",
7170
")"
7271
]
7372
},
@@ -86,7 +85,7 @@
8685
],
8786
"source": [
8887
"# Run the inference\n",
89-
"inferer.infer()"
88+
"inferer.infer(save_intermediate=True) # save_intermediate needs to be set to True for latency benchmarks."
9089
]
9190
},
9291
{
@@ -1330,7 +1329,7 @@
13301329
"name": "python",
13311330
"nbconvert_exporter": "python",
13321331
"pygments_lexer": "ipython3",
1333-
"version": "3.9.12 (main, Apr 5 2022, 06:56:58) \n[GCC 7.5.0]"
1332+
"version": "3.9.12"
13341333
},
13351334
"orig_nbformat": 4,
13361335
"vscode": {

examples/pannuke_nuclei_segmentation_cellpose.ipynb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,6 @@
899899
" out_boundary_weights={\"cellpose\": False, \"type\": False},\n",
900900
" resize=(256, 256), # Not actually resizing anything,\n",
901901
" instance_postproc=\"cellpose\",\n",
902-
" save_intermediate=True, # save intermediate soft masks for visualization\n",
903902
" batch_size=8,\n",
904903
" n_images=50, # Use only the 50 first images of the folder\n",
905904
" normalization=\"minmax\",\n",
@@ -955,7 +954,6 @@
955954
"samples = list(inferer.out_masks.keys())\n",
956955
"for i, ix in enumerate(ixs):\n",
957956
" masks = inferer.out_masks[samples[ix]]\n",
958-
" inter = inferer.soft_masks[samples[ix]]\n",
959957
"\n",
960958
" img_path = save_dir / \"valid\" / f\"images/{samples[ix]}.png\"\n",
961959
" img = FileHandler.read_img(img_path)\n",

examples/pannuke_nuclei_segmentation_cellpose_dinov2.ipynb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,6 @@
895895
" out_boundary_weights={\"cellpose\": False, \"type\": False},\n",
896896
" resize=(252, 252), # resize the input images to a multiple of 14,\n",
897897
" instance_postproc=\"cellpose\",\n",
898-
" save_intermediate=True, # save intermediate soft masks for visualization\n",
899898
" batch_size=8,\n",
900899
" n_images=50, # Use only the 50 first images of the folder\n",
901900
" normalization=\"percentile\",\n",
@@ -951,7 +950,6 @@
951950
"samples = list(inferer.out_masks.keys())\n",
952951
"for i, ix in enumerate(ixs):\n",
953952
" masks = inferer.out_masks[samples[ix]]\n",
954-
" inter = inferer.soft_masks[samples[ix]]\n",
955953
"\n",
956954
" img_path = save_dir / \"valid\" / f\"images/{samples[ix]}.png\"\n",
957955
" img = FileHandler.read_img(img_path)\n",

examples/pannuke_nuclei_segmentation_cellvit.ipynb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -904,7 +904,6 @@
904904
" out_boundary_weights={\"hovernet\": False, \"inst\": False, \"type\": False},\n",
905905
" resize=(256, 256), # Not actually resizing anything,\n",
906906
" instance_postproc=\"hovernet\",\n",
907-
" save_intermediate=True, # save intermediate soft masks for visualization\n",
908907
" batch_size=8,\n",
909908
" n_images=50, # Use only the 50 first images of the folder\n",
910909
" normalization=\"minmax\",\n",
@@ -960,7 +959,6 @@
960959
"samples = list(inferer.out_masks.keys())\n",
961960
"for i, ix in enumerate(ixs):\n",
962961
" masks = inferer.out_masks[samples[ix]]\n",
963-
" inter = inferer.soft_masks[samples[ix]]\n",
964962
"\n",
965963
" img_path = save_dir / \"valid\" / f\"images/{samples[ix]}.png\"\n",
966964
" img = FileHandler.read_img(img_path)\n",

examples/pannuke_nuclei_segmentation_cppnet.ipynb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -993,7 +993,6 @@
993993
" out_boundary_weights=out_weights,\n",
994994
" resize=(256, 256), # Not actually resizing anything,\n",
995995
" instance_postproc=\"stardist\",\n",
996-
" save_intermediate=True, # save intermediate soft masks for visualization\n",
997996
" batch_size=8,\n",
998997
" n_images=50, # Use only the 50 first images of the folder,\n",
999998
" normalization=\"percentile\"\n",
@@ -1048,7 +1047,6 @@
10481047
"samples = list(inferer.out_masks.keys())\n",
10491048
"for i, ix in enumerate(ixs):\n",
10501049
" masks = inferer.out_masks[samples[ix]]\n",
1051-
" inter = inferer.soft_masks[samples[ix]]\n",
10521050
"\n",
10531051
" img_path = save_dir / \"valid\" / f\"images/{samples[ix]}.png\"\n",
10541052
" img = FileHandler.read_img(img_path)\n",

examples/pannuke_nuclei_segmentation_hovernet.ipynb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2725,7 +2725,6 @@
27252725
" out_boundary_weights={\"hovernet\": False, \"inst\": False, \"type\": False},\n",
27262726
" resize=(256, 256), # Not actually resizing anything,\n",
27272727
" instance_postproc=\"hovernet\",\n",
2728-
" save_intermediate=True, # save intermediate soft masks for visualization\n",
27292728
" batch_size=8,\n",
27302729
" n_images=50, # Use only the 50 first images of the folder\n",
27312730
" normalization=\"minmax\",\n",
@@ -2781,7 +2780,6 @@
27812780
"samples = list(inferer.out_masks.keys())\n",
27822781
"for i, ix in enumerate(ixs):\n",
27832782
" masks = inferer.out_masks[samples[ix]]\n",
2784-
" inter = inferer.soft_masks[samples[ix]]\n",
27852783
"\n",
27862784
" img_path = save_dir / \"valid\" / f\"images/{samples[ix]}.png\"\n",
27872785
" img = FileHandler.read_img(img_path)\n",

examples/pannuke_nuclei_segmentation_omnipose.ipynb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,6 @@
753753
" out_boundary_weights={\"omnipose\": False, \"type\": False},\n",
754754
" resize=(256, 256), # Not actually resizing anything,\n",
755755
" instance_postproc=\"omnipose\",\n",
756-
" save_intermediate=True, # save intermediate soft masks for visualization\n",
757756
" batch_size=8,\n",
758757
" n_images=50, # Use only the 50 first images of the folder\n",
759758
" normalization=\"percentile\",\n",
@@ -809,7 +808,6 @@
809808
"samples = list(inferer.out_masks.keys())\n",
810809
"for i, ix in enumerate(ixs):\n",
811810
" masks = inferer.out_masks[samples[ix]]\n",
812-
" inter = inferer.soft_masks[samples[ix]]\n",
813811
"\n",
814812
" img_path = save_dir / \"valid\" / f\"images/{samples[ix]}.png\"\n",
815813
" img = FileHandler.read_img(img_path)\n",

0 commit comments

Comments
 (0)