From bed1bbbe8aab323ce60848f2cd354a9e4c76cc49 Mon Sep 17 00:00:00 2001 From: anwai98 Date: Tue, 3 Oct 2023 22:50:52 +0200 Subject: [PATCH 1/4] Update import for livecell inference --- micro_sam/evaluation/livecell.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/micro_sam/evaluation/livecell.py b/micro_sam/evaluation/livecell.py index 752a0359..ed116519 100644 --- a/micro_sam/evaluation/livecell.py +++ b/micro_sam/evaluation/livecell.py @@ -15,7 +15,7 @@ from segment_anything import SamPredictor from tqdm import tqdm -from ..instance_segmentation import AutomaticMaskGenerator, EmbeddingMaskGenerator +from ..instance_segmentation import AutomaticMaskGenerator, _EmbeddingMaskGenerator from . import automatic_mask_generation, inference, evaluation from .experiments import default_experiment_settings, full_experiment_settings @@ -169,7 +169,7 @@ def run_livecell_amg( if use_mws: amg_prefix = "amg_mws" - AMG = EmbeddingMaskGenerator + AMG = _EmbeddingMaskGenerator else: amg_prefix = "amg" AMG = AutomaticMaskGenerator @@ -231,8 +231,8 @@ def run_livecell_inference() -> None: # - automatic mask generation (auto) # if none of the two are active then the prompt setting arguments will be parsed # and used to run inference for a single prompt setting - parser.add_argument("-f", "--full_experiment", action="store_true") parser.add_argument("-d", "--default_experiment", action="store_true") + parser.add_argument("-f", "--full_experiment", action="store_true") parser.add_argument("-a", "--auto_mask_generation", action="store_true") # the prompt settings for an individual inference run @@ -242,7 +242,7 @@ def run_livecell_inference() -> None: parser.add_argument("-n", "--negative", type=int, default=0, help="No. of negative prompts") # optional external prompt folder - parser.add_argument("--prompt_folder", help="") + parser.add_argument("--prompt_folder", help="Provide the path where all input point prompts will be stored") args = parser.parse_args() if sum([args.full_experiment, args.default_experiment, args.auto_mask_generation]) > 2: From 7f5de7461acfd7651896b9e866e8b22b996b011e Mon Sep 17 00:00:00 2001 From: anwai98 Date: Tue, 3 Oct 2023 22:51:23 +0200 Subject: [PATCH 2/4] Update workers in dataloader for finetuning --- finetuning/livecell_finetuning.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/finetuning/livecell_finetuning.py b/finetuning/livecell_finetuning.py index caac2905..9c533391 100644 --- a/finetuning/livecell_finetuning.py +++ b/finetuning/livecell_finetuning.py @@ -22,10 +22,10 @@ def get_dataloaders(patch_shape, data_path, cell_type=None): """ label_transform = torch_em.transform.label.label_consecutive # to ensure consecutive IDs train_loader = get_livecell_loader(path=data_path, patch_shape=patch_shape, split="train", batch_size=2, - num_workers=8, cell_types=cell_type, download=True, + num_workers=16, cell_types=cell_type, download=True, label_transform=label_transform, shuffle=True) val_loader = get_livecell_loader(path=data_path, patch_shape=patch_shape, split="val", batch_size=1, - num_workers=8, cell_types=cell_type, download=True, + num_workers=16, cell_types=cell_type, download=True, label_transform=label_transform, shuffle=True) return train_loader, val_loader From 90b62d68c4e61757fe904a0919cc7a18a64b3051 Mon Sep 17 00:00:00 2001 From: anwai98 Date: Tue, 3 Oct 2023 22:52:37 +0200 Subject: [PATCH 3/4] Update .gitignore --- finetuning/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/finetuning/.gitignore b/finetuning/.gitignore index 60fd41c2..d6643f86 100644 --- a/finetuning/.gitignore +++ b/finetuning/.gitignore @@ -2,3 +2,4 @@ checkpoints/ logs/ sam_embeddings/ results/ +*.sh \ No newline at end of file From b097fe9a2fe49c92af4b49a1218eb1338ad86842 Mon Sep 17 00:00:00 2001 From: anwai98 Date: Tue, 3 Oct 2023 23:04:03 +0200 Subject: [PATCH 4/4] Fix spellings in the documentation --- doc/finetuned_models.md | 4 ++-- doc/python_library.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/finetuned_models.md b/doc/finetuned_models.md index 4fc9fb13..ceedfc71 100644 --- a/doc/finetuned_models.md +++ b/doc/finetuned_models.md @@ -26,8 +26,8 @@ See for example the [2d annotator example](https://github.com/computational-cell As a rule of thumb: - Use the `_lm` models for segmenting cells or nuclei in light microscopy. -- Use the `_em` models for segmenting ceells or neurites in electron microscopy. - - Note that this model does not work well for segmenting mitochondria or other organelles becuase it is biased towards segmenting the full cell / cellular compartment. +- Use the `_em` models for segmenting cells or neurites in electron microscopy. + - Note that this model does not work well for segmenting mitochondria or other organelles because it is biased towards segmenting the full cell / cellular compartment. - For other cases use the default models. See also the figures above for examples where the finetuned models work better than the vanilla models. diff --git a/doc/python_library.md b/doc/python_library.md index dbab4b0a..7ab07b12 100644 --- a/doc/python_library.md +++ b/doc/python_library.md @@ -6,8 +6,8 @@ import micro_sam ``` The library -- implements function to apply Segment Anything to 2d and 3d data more conviently in `micro_sam.prompt_based_segmentation`. -- provides more and imporoved automatic instance segmentation functionality in `micro_sam.instance_segmentation`. +- implements function to apply Segment Anything to 2d and 3d data more conveniently in `micro_sam.prompt_based_segmentation`. +- provides more and improved automatic instance segmentation functionality in `micro_sam.instance_segmentation`. - implements training functionality that can be used for finetuning on your own data in `micro_sam.training`. - provides functionality for quantitative and qualitative evaluation of Segment Anything models in `micro_sam.evaluation`.