diff --git a/micro_sam/evaluation/instance_segmentation.py b/micro_sam/evaluation/instance_segmentation.py index 5e657190..ad1956b9 100644 --- a/micro_sam/evaluation/instance_segmentation.py +++ b/micro_sam/evaluation/instance_segmentation.py @@ -227,14 +227,16 @@ def run_instance_segmentation_grid_search( gt = _load_image(gt_path, gt_key, roi=None if rois is None else rois[i]) if embedding_dir is None: - segmenter.initialize(image) + embedding_path = None else: assert predictor is not None embedding_path = os.path.join(embedding_dir, f"{os.path.splitext(image_name)[0]}.zarr") - image_embeddings = util.precompute_image_embeddings( - predictor, image, embedding_path, ndim=2, verbose=verbose_embeddings - ) - segmenter.initialize(image, image_embeddings) + + image_embeddings = util.precompute_image_embeddings( + predictor, image, embedding_path, ndim=2, verbose=verbose_embeddings + ) + + segmenter.initialize(image, image_embeddings) _grid_search_iteration( segmenter, gs_combinations, gt, image_name,