Skip to content

Commit 544b1e8

Browse files
Enable using fine-tuned model in the image series annotator
1 parent b9918c8 commit 544b1e8

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

examples/image_series_annotator.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,29 @@
22
from micro_sam.sample_data import fetch_image_series_example_data
33

44

5-
def series_annotation():
6-
"""Annotate a series of images. Example runs for three different example images.
5+
def series_annotation(use_finetuned_model):
6+
"""Annotate a series of images. Example runs for three different images.
77
"""
8+
9+
if use_finetuned_model:
10+
embedding_path = "./embeddings/series-embeddings-vit_h_lm"
11+
model_type = "vit_h_lm"
12+
else:
13+
embedding_path = "./embeddings/series-embeddings"
14+
model_type = "vit_h"
15+
816
example_data = fetch_image_series_example_data("./data")
917
image_folder_annotator(
10-
example_data, "./data/series-segmentation-result", embedding_path="./embeddings/series-embeddings",
11-
pattern="*.tif", model_type="vit_b"
18+
example_data, "./data/series-segmentation-result", embedding_path=embedding_path,
19+
pattern="*.tif", model_type=model_type
1220
)
1321

1422

1523
def main():
16-
series_annotation()
24+
# whether to use the fine-tuned SAM model
25+
# this feature is still experimental!
26+
use_finetuned_model = False
27+
series_annotation(use_finetuned_model)
1728

1829

1930
if __name__ == "__main__":

0 commit comments

Comments
 (0)