Skip to main content

DOC PyPI Conda codecov Image.sc forum DOI

Segment Anything for Microscopy 2

Tools for segmentation, tracking and classification in microscopy built on Segment Anything 2 (SAM2). Segment, track and classify objects in microscopy images interactively with a few clicks, or automatically.

We implement napari applications for:

  • interactive and automatic segmentation of 2d images and 3d volumes
  • interactive and automatic tracking of cells in 2d timeseries
  • classification of segmented objects, for example into cell types
  • pixel classification, for example for tissue or region segmentation
  • batch annotation of all images in a folder with any of these tools

We also provide the micro-sam2 models, which are finetuned on microscopy data, and the micro_sam python library to apply them to your data and to finetune them. The functionality of the previous version, based on the original Segment Anything (SAM1), is still available in the micro_sam.v1 subpackage and in the micro_sam v1 command line tools.


Interactive cell segmentation with box prompts

Interactive mitochondria segmentation in a 3d EM volume

Interactive tracking of a dividing cell

Object classification of round and elongated cells, with corrections

Pixel classification of tissue in histopathology, with corrections

The GIFs are recorded with scripts/readme_gifs/make_gifs.py.

If you run into any problems or have questions about our tool, please open an issue on GitHub or contact us via image.sc using the tag micro-sam, and tagging @anwai98 and @constantinpape. You can follow recent updates on micro_sam in our news feed.

Installation and Usage

Please check the documentation for details on how to install and use micro_sam. You can also watch the quickstart video, our virtual I2K workshop video or all video tutorials. The videos show the previous version, so the user interface differs from the current one.

micro_sam works best with a GPU or on a Mac with an M-series chip. On a CPU it is slow, in particular for 3d segmentation.

Contributing

We always welcome new contributions!

If you just want to suggest a documentation edit, you can do this directly here, on GitHub. For more complex changes, see CONTRIBUTING.md or the contributing guide in our documentation for details. The first step is to discuss your idea in a new issue with the current developers.

Everyone participating in this project is expected to follow our Code of Conduct.

Citation

If you use this repository in your research, please cite

There is one other napari plugin built around Segment Anything 2:

Compared to this plugin we support more applications (2d, 3d, tracking and classification), and provide finetuning methods and finetuned models for microscopy data. WebKnossos, QuPath and Fiji also integrate Segment Anything 2 for interactive segmentation, mainly in 2d.

We have also built follow-up work that is based on micro_sam:

Release Overview

You can find an overview of changes introduced in previous releases here.

Metadata

Release files for micro-sam 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for micro-sam 2.0.0
File Size Uploaded Provenance Actions
micro_sam-2.0.0.tar.gz 736.6 kB With provenance Details for micro_sam-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for micro-sam 2.0.0
File Interpreter ABI Platform Actions
micro_sam-2.0.0-py3-none-any.whl Python 3 none any Details for micro_sam-2.0.0-py3-none-any.whl

Total release size: 1.5 MB

Release files / micro_sam-2.0.0.tar.gz

Download URL micro_sam-2.0.0.tar.gz
Size 736.6 kB
Tags Source
SHA-256 checksum
How to use checksums
07752c774df585d6696ccae11c6606990a5262c003a7d4a4b23531f73bc3391c
BLAKE2b-256 checksum
How to use checksums
ec03df9231127e08e804b0c0e0a7ae11ea0a3bfba2a68c9020061ea7b0f94305
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Release files / micro_sam-2.0.0-py3-none-any.whl

Download URL micro_sam-2.0.0-py3-none-any.whl
Size 806.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dfb387fcb27ba9c93c0ff4dbcd473af5fe007cfba1388bbe7df5b5ee52aeb80f
BLAKE2b-256 checksum
How to use checksums
da9bfe93f4033ac003406c040ce8c7bd66d604fc75678831ab46f0c6cee576a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Security for micro-sam 2.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for micro_sam-2.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page