Skip to content

Commit

Permalink
Add docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
anwai98 committed Sep 24, 2024
1 parent 6470984 commit 1d74fbc
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
18 changes: 16 additions & 2 deletions micro_sam/instance_segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1157,8 +1157,22 @@ def automatic_instance_segmentation(
halo: Optional[Tuple[int, int]] = None,
use_amg: bool = False,
**generate_kwargs
):
"""
) -> None:
"""Run automatic segmentation for the input image.
Args:
input_path: input_path: The input image file(s). Can either be a single image file (e.g. tif or png),
or a container file (e.g. hdf5 or zarr).
output_path: The output path where the instance segmentations will be saved.
embedding_path: The path where the embeddings are cached already / will be saved.
model_type: The SegmentAnything model to use. Will use the standard vit_l model by default.
checkpoint_path: Path to a checkpoint for a custom model.
key: The key to the input file. This is needed for container files (eg. hdf5 or zarr)
or to load several images as 3d volume. Provide a glob patterm, eg. "*.tif", for this case.
ndim: The dimensionality of the data.
tile_shape: Shape of the tiles for tiled prediction. By default prediction is run without tiling.
halo: Overlap of the tiles for tiled prediction.
use_amg: Whether to use Automatic Mask Generation (AMG) as the automatic segmentation method.
"""
predictor, state = util.get_sam_model(model_type=model_type, checkpoint_path=checkpoint_path, return_state=True)

Expand Down
4 changes: 2 additions & 2 deletions micro_sam/precompute_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,10 @@ def precompute_state(
a container file (e.g. hdf5 or zarr) or a folder with images files.
In case of a container file the argument `key` must be given. In case of a folder
it can be given to provide a glob pattern to subselect files from the folder.
output_path: The output path were the embeddings and other state will be saved.
output_path: The output path where the embeddings and other state will be saved.
pattern: Glob pattern to select files in a folder. The embeddings will be computed
for each of these files. To select all files in a folder pass "*".
model_type: The SegmentAnything model to use. Will use the standard vit_h model by default.
model_type: The SegmentAnything model to use. Will use the standard vit_l model by default.
checkpoint_path: Path to a checkpoint for a custom model.
key: The key to the input file. This is needed for contaner files (e.g. hdf5 or zarr)
or to load several images as 3d volume. Provide a glob pattern, e.g. "*.tif", for this case.
Expand Down
2 changes: 1 addition & 1 deletion micro_sam/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
from tqdm import tqdm

# this is the default model used in micro_sam
# currently set to the default vit_h
# currently set to the default vit_l
_DEFAULT_MODEL = "vit_l"

# The valid model types. Each type corresponds to the architecture of the
Expand Down

0 comments on commit 1d74fbc

Please sign in to comment.