Skip to main content

Segment Anything Model (SAM) in Napari

License Apache Software License 2.0 PyPI Python Version tests codecov napari hub

Segment anything with our Napari integration of Meta AI's new Segment Anything Model (SAM)!

SAM is the new segmentation system from Meta AI capable of one-click segmentation of any object, and now, our plugin neatly integrates this into Napari.

We have already extended SAM's click-based foreground separation to full click-based semantic segmentation and instance segmentation!

At last, our SAM integration supports both 2D and 3D images!


Everything mode Click-based semantic segmentation mode Click-based instance segmentation mode

SAM in Napari demo

Click to play the video


Installation

The plugin requires python>=3.8, as well as pytorch>=1.7 and torchvision>=0.8. Please follow the instructions here to install both PyTorch and TorchVision dependencies. Installing both PyTorch and TorchVision with CUDA support is strongly recommended.

Install Napari via pip:

pip install napari[all]

You can install napari-sam via pip:

pip install git+https://github.com/facebookresearch/segment-anything.git
pip install napari-sam

To install latest development version :

pip install git+https://github.com/MIC-DKFZ/napari-sam.git

Usage

Start Napari from the console with:

napari

Then navigate to Plugins -> Segment Anything (napari-sam) and drag & drop an image into Napari. At last create, a labels layer that will be used for the SAM predictions, by clicking in the layer list on the third button.

You can then auto-download one of the available SAM models (this can take 1-2 minutes), activate one of the annotations & segmentation modes, and you are ready to go!

Contributing

Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.

License

Distributed under the terms of the Apache Software License 2.0 license, "napari-sam" is free and open source software

Issues

If you encounter any problems, please file an issue along with a detailed description.

Acknowledgements

napari-sam is developed and maintained by the Applied Computer Vision Lab (ACVL) of Helmholtz Imaging and the Division of Medical Image Computing at the German Cancer Research Center (DKFZ).

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

napari-sam-0.3.17.tar.gz (21.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

napari_sam-0.3.17-py3-none-any.whl (19.7 kB view details)

Uploaded Python 3

File details

Details for the file napari-sam-0.3.17.tar.gz.

File metadata

  • Download URL: napari-sam-0.3.17.tar.gz
  • Upload date:
  • Size: 21.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for napari-sam-0.3.17.tar.gz
Algorithm Hash digest
SHA256 0d66f63d75e9d3a19f634a9d3a44cbf0bdca53e171d50c58d4e2e31da23d7517
MD5 7b09c72cc0c0808930694eaeef9e1012
BLAKE2b-256 084fedd1727e993dac20b8d5a6c74b8757a85e375b5236d3e00560f50815ad3b

See more details on using hashes here.

File details

Details for the file napari_sam-0.3.17-py3-none-any.whl.

File metadata

  • Download URL: napari_sam-0.3.17-py3-none-any.whl
  • Upload date:
  • Size: 19.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for napari_sam-0.3.17-py3-none-any.whl
Algorithm Hash digest
SHA256 0d329c1675b86472f6a12336ad1b0c90cadfb98b89337d0912c3fd483fc7767c
MD5 cda20f2cad6a273ded1770e05f157a88
BLAKE2b-256 958427297ec9b631cb219f47d7eb5c7e6f7093bf2bc2593a34b30982d933521b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page