Skip to content

Commit c307ccf

Browse files
Merge pull request #93 from computational-cell-analytics/release-010
Release 010
2 parents f29a18d + 6b6a466 commit c307ccf

File tree

6 files changed

+49
-24
lines changed

6 files changed

+49
-24
lines changed

.github/workflows/build_docs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: build_documentation
22

3-
# build the documentation for a new commit
3+
# build the documentation for a new commit
44
on:
55
release:
66
types: created

README.md

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,14 @@ We implement napari applications for:
1010
- interactive 3d segmentation
1111
- interactive tracking of 2d image data
1212

13-
**Early beta version**
13+
**Beta version**
1414

15-
This is an early beta version. Any feedback is welcome, but please be aware that the functionality is under active development and that several features are not finalized or thoroughly tested yet.
16-
Once the functionality has matured we plan to release the interactive annotation applications as [napari plugins](https://napari.org/stable/plugins/index.html).
15+
This is an advanced beta version. While many features are still under development, we aim to keep the user interface and python library stable.
16+
Any feedback is welcome, but please be aware that the functionality is under active development and that some features may not be thoroughly tested yet.
17+
We will soon provide a stand-alone application for running the `micro_sam` annotation tools, and plan to also release it as [napari plugin](https://napari.org/stable/plugins/index.html) in the future.
1718

1819
If you run into any problems or have questions please open an issue or reach out via [image.sc](https://forum.image.sc/) using the tag `micro-sam` and tagging @constantinpape.
1920

20-
**New in version 0.02**
21-
22-
- We have added support for bounding box prompts (see the gif below), which provide better segmentation results than points in many cases.
23-
- Interactive tracking now uses a better heuristic to propagate masks across time, leading to better automatic tracking results.
24-
- And have fixed several small bugs.
25-
2621
![box-prompts](https://github.com/computational-cell-analytics/micro-sam/assets/4263537/d04cb158-9f5b-4460-98cd-023c4f19cccd)
2722

2823

@@ -195,3 +190,24 @@ There are two other napari plugins build around segment anything:
195190

196191
Compared to these we support more applications (2d, 3d and tracking), and aim to further extend and specialize SegmentAnything for microscopy data.
197192
[WebKnossos](https://webknossos.org/) also offers integration of SegmentAnything for interactive segmentation.
193+
194+
195+
## Release Overview
196+
197+
**New in version 0.1.0**
198+
199+
- We support tiling in all annotators to enable processing large images.
200+
- Implement new automatic instance segmentation functionality:
201+
- That is faster.
202+
- Enables interactive update of parameters.
203+
- And also works for large images by making use of tiled embeddings.
204+
- Implement the `image_series_annotator` for processing many images in a row.
205+
- Use the data hash in pre-computed embeddings to warn if the input data changes.
206+
- Create a simple GUI to select which annotator to start.
207+
- And made many other small improvements and fixed bugs.
208+
209+
**New in version 0.0.2**
210+
211+
- We have added support for bounding box prompts, which provide better segmentation results than points in many cases.
212+
- Interactive tracking now uses a better heuristic to propagate masks across time, leading to better automatic tracking results.
213+
- And have fixed several small bugs.

build_doc.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pdoc --docformat google --logo "https://raw.githubusercontent.com/computational-cell-analytics/micro-sam/master/doc/images/micro-sam-logo.png" micro_sam

doc/start_page.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,15 @@
22

33
Segment Anything for Microscopy implements automatic and interactive annotation for microscopy data. It is built on top of [Segment Anything](https://segment-anything.com/) by Meta AI and specializes it for microscopy and other bio-imaging data.
44
Its core components are:
5-
- The `micro_sam` annotator tools: interactive data annotation with [napari](https://napari.org/stable/) applications.
6-
- The `micro_sam` library: apply Segment Anything to multi-dimensional data or fine-tune it on your data.
7-
- The `micro_sam` models: Segment Anything models fine-tuned on publicly available microscopy data.
5+
- The `micro_sam` annotator tools for interactive data annotation with [napari](https://napari.org/stable/).
6+
- The `micro_sam` library to apply Segment Anything to 2 and 3d data or fine-tune it on your data.
7+
- The `micro_sam` models that are fine-tuned on publicly available microscopy data.
8+
9+
Our goal is to build fast and interactive annotation tools for microscopy data, like interactive cell segmentation from bounding boxes:
10+
11+
![box-prompts](https://github.com/computational-cell-analytics/micro-sam/assets/4263537/d04cb158-9f5b-4460-98cd-023c4f19cccd)
12+
13+
Beta version, Roadmap etc.
814

915
## Quickstart
1016

micro_sam/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.0.2"
1+
__version__ = "0.1.0"

micro_sam/util.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
except ImportError:
2323
from tqdm import tqdm
2424

25-
MODEL_URLS = {
25+
_MODEL_URLS = {
2626
"vit_h": "https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth",
2727
"vit_l": "https://dl.fbaipublicfiles.com/segment_anything/sam_vit_l_0b3195.pth",
2828
"vit_b": "https://dl.fbaipublicfiles.com/segment_anything/sam_vit_b_01ec64.pth"
2929
}
30-
CHECKPOINT_FOLDER = os.environ.get("SAM_MODELS", os.path.expanduser("~/.sam_models"))
31-
CHECKSUMS = {
30+
_CHECKPOINT_FOLDER = os.environ.get("SAM_MODELS", os.path.expanduser("~/.sam_models"))
31+
_CHECKSUMS = {
3232
"vit_h": "a7bf3b02f3ebf1267aba913ff637d9a2d5c33d3173bb679e46d9f338c26f262e",
3333
"vit_l": "3adcc4315b642a4d2101128f611684e8734c41232a17c648ed1693702a49a622",
3434
"vit_b": "ec2df62732614e57411cdcf32a23ffdf28910380d03139ee0f4fcbe91eb8c912"
@@ -52,7 +52,7 @@ def _download(url, path, model_type):
5252
copyfileobj(r_raw, f)
5353

5454
# validate the checksum
55-
expected_checksum = CHECKSUMS[model_type]
55+
expected_checksum = _CHECKSUMS[model_type]
5656
if expected_checksum is None:
5757
return
5858
with open(path, "rb") as f:
@@ -68,13 +68,13 @@ def _download(url, path, model_type):
6868

6969
def _get_checkpoint(model_type, checkpoint_path=None):
7070
if checkpoint_path is None:
71-
checkpoint_url = MODEL_URLS[model_type]
71+
checkpoint_url = _MODEL_URLS[model_type]
7272
checkpoint_name = checkpoint_url.split("/")[-1]
73-
checkpoint_path = os.path.join(CHECKPOINT_FOLDER, checkpoint_name)
73+
checkpoint_path = os.path.join(_CHECKPOINT_FOLDER, checkpoint_name)
7474

7575
# download the checkpoint if necessary
7676
if not os.path.exists(checkpoint_path):
77-
os.makedirs(CHECKPOINT_FOLDER, exist_ok=True)
77+
os.makedirs(_CHECKPOINT_FOLDER, exist_ok=True)
7878
_download(checkpoint_url, checkpoint_path, model_type)
7979
elif not os.path.exists(checkpoint_path):
8080
raise ValueError(f"The checkpoint path {checkpoint_path} that was passed does not exist.")
@@ -502,17 +502,19 @@ def load_image_data(
502502
return image_data
503503

504504

505-
# TODO enable passing options for get_sam
506505
def main():
506+
"""@private"""
507507
import argparse
508508

509-
parser = argparse.ArgumentParser()
509+
parser = argparse.ArgumentParser(description="Compute the embeddings for an image.")
510510
parser.add_argument("-i", "--input_path", required=True)
511511
parser.add_argument("-o", "--output_path", required=True)
512+
parser.add_argument("-m", "--model_type", default="vit_h")
513+
parser.add_argument("-c", "--checkpoint_path", default=None)
512514
parser.add_argument("-k", "--key")
513515
args = parser.parse_args()
514516

515-
predictor = get_sam_model()
517+
predictor = get_sam_model(model_type=args.model_type, checkpoint_path=args.checkpoint_path)
516518
with open_file(args.input_path, mode="r") as f:
517519
data = f[args.key]
518520
precompute_image_embeddings(predictor, data, save_path=args.output_path)

0 commit comments

Comments
 (0)