Skip to content

Commit 884efb2

Browse files
Some updates to the instance_segmentation example
1 parent 1227bf8 commit 884efb2

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

examples/use_as_library/instance_segmentation.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ def cell_segmentation():
5050

5151
# Generate the instance segmentation. You can call this again for different values of 'pred_iou_thresh'
5252
# without having to call initialize again.
53-
# NOTE: the main advantage of this method is that it's considerably faster than the original implementation.
53+
# NOTE: the main advantage of this method is that it's faster than the original implementation,
54+
# however the quality is not as high as the original instance segmentation quality yet.
5455
instances_mws = amg_mws.generate(pred_iou_thresh=0.88)
5556
instances_mws = instance_segmentation.mask_data_to_segmentation(
5657
instances_mws, shape=image.shape, with_background=True
@@ -64,7 +65,7 @@ def cell_segmentation():
6465
napari.run()
6566

6667

67-
def segmentation_with_tiling():
68+
def cell_segmentation_with_tiling():
6869
"""Run the instance segmentation functionality from micro_sam for segmentation of
6970
cells in a large image. You need to run examples/annotator_2d.py:wholeslide_annotator once before
7071
running this script so that all required data is downloaded and pre-computed.
@@ -111,20 +112,21 @@ def segmentation_with_tiling():
111112

112113
# Generate the instance segmentation. You can call this again for different values of 'pred_iou_thresh'
113114
# without having to call initialize again.
114-
# NOTE: the main advantage of this method is that it's considerably faster than the original implementation.
115+
# NOTE: the main advantage of this method is that it's faster than the original implementation.
116+
# however the quality is not as high as the original instance segmentation quality yet.
115117
instances_mws = amg_mws.generate(pred_iou_thresh=0.88)
116118

117119
# Show the results.
118120
v = napari.Viewer()
119121
v.add_image(image)
120-
# v.add_labels(instances_amg)
122+
v.add_labels(instances_amg)
121123
v.add_labels(instances_mws)
122124
napari.run()
123125

124126

125127
def main():
126128
cell_segmentation()
127-
# segmentation_with_tiling()
129+
# cell_segmentation_with_tiling()
128130

129131

130132
if __name__ == "__main__":

0 commit comments

Comments
 (0)