Skip to content

Commit 6bbfc42

Browse files
Merge pull request #219 from computational-cell-analytics/u-import
Fix Imports in Livecell Inference
2 parents 34c9f8d + 8a3f104 commit 6bbfc42

File tree

5 files changed

+11
-10
lines changed

5 files changed

+11
-10
lines changed

doc/finetuned_models.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ See for example the [2d annotator example](https://github.com/computational-cell
2626

2727
As a rule of thumb:
2828
- Use the `_lm` models for segmenting cells or nuclei in light microscopy.
29-
- Use the `_em` models for segmenting ceells or neurites in electron microscopy.
30-
- 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.
29+
- Use the `_em` models for segmenting cells or neurites in electron microscopy.
30+
- 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.
3131
- For other cases use the default models.
3232

3333
See also the figures above for examples where the finetuned models work better than the vanilla models.

doc/python_library.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import micro_sam
66
```
77

88
The library
9-
- implements function to apply Segment Anything to 2d and 3d data more conviently in `micro_sam.prompt_based_segmentation`.
10-
- provides more and imporoved automatic instance segmentation functionality in `micro_sam.instance_segmentation`.
9+
- implements function to apply Segment Anything to 2d and 3d data more conveniently in `micro_sam.prompt_based_segmentation`.
10+
- provides more and improved automatic instance segmentation functionality in `micro_sam.instance_segmentation`.
1111
- implements training functionality that can be used for finetuning on your own data in `micro_sam.training`.
1212
- provides functionality for quantitative and qualitative evaluation of Segment Anything models in `micro_sam.evaluation`.
1313

finetuning/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ checkpoints/
22
logs/
33
sam_embeddings/
44
results/
5+
*.sh

finetuning/livecell_finetuning.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ def get_dataloaders(patch_shape, data_path, cell_type=None):
2222
"""
2323
label_transform = torch_em.transform.label.label_consecutive # to ensure consecutive IDs
2424
train_loader = get_livecell_loader(path=data_path, patch_shape=patch_shape, split="train", batch_size=2,
25-
num_workers=8, cell_types=cell_type, download=True,
25+
num_workers=16, cell_types=cell_type, download=True,
2626
label_transform=label_transform, shuffle=True)
2727
val_loader = get_livecell_loader(path=data_path, patch_shape=patch_shape, split="val", batch_size=1,
28-
num_workers=8, cell_types=cell_type, download=True,
28+
num_workers=16, cell_types=cell_type, download=True,
2929
label_transform=label_transform, shuffle=True)
3030
return train_loader, val_loader
3131

micro_sam/evaluation/livecell.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from segment_anything import SamPredictor
1616
from tqdm import tqdm
1717

18-
from ..instance_segmentation import AutomaticMaskGenerator, EmbeddingMaskGenerator
18+
from ..instance_segmentation import AutomaticMaskGenerator, _EmbeddingMaskGenerator
1919
from . import automatic_mask_generation, inference, evaluation
2020
from .experiments import default_experiment_settings, full_experiment_settings
2121

@@ -169,7 +169,7 @@ def run_livecell_amg(
169169

170170
if use_mws:
171171
amg_prefix = "amg_mws"
172-
AMG = EmbeddingMaskGenerator
172+
AMG = _EmbeddingMaskGenerator
173173
else:
174174
amg_prefix = "amg"
175175
AMG = AutomaticMaskGenerator
@@ -231,8 +231,8 @@ def run_livecell_inference() -> None:
231231
# - automatic mask generation (auto)
232232
# if none of the two are active then the prompt setting arguments will be parsed
233233
# and used to run inference for a single prompt setting
234-
parser.add_argument("-f", "--full_experiment", action="store_true")
235234
parser.add_argument("-d", "--default_experiment", action="store_true")
235+
parser.add_argument("-f", "--full_experiment", action="store_true")
236236
parser.add_argument("-a", "--auto_mask_generation", action="store_true")
237237

238238
# the prompt settings for an individual inference run
@@ -242,7 +242,7 @@ def run_livecell_inference() -> None:
242242
parser.add_argument("-n", "--negative", type=int, default=0, help="No. of negative prompts")
243243

244244
# optional external prompt folder
245-
parser.add_argument("--prompt_folder", help="")
245+
parser.add_argument("--prompt_folder", help="Provide the path where all input point prompts will be stored")
246246

247247
args = parser.parse_args()
248248
if sum([args.full_experiment, args.default_experiment, args.auto_mask_generation]) > 2:

0 commit comments

Comments
 (0)