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


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).

Metadata

Release files for napari-sam 0.4.13

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

Source distribution (sdist)

Source distribution for napari-sam 0.4.13
File Size Uploaded
napari-sam-0.4.13.tar.gz 23.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for napari-sam 0.4.13
File Interpreter ABI Platform
napari_sam-0.4.13-py3-none-any.whl Python 3 none any Details

Total release size: 46.8 kB

Release files / napari-sam-0.4.13.tar.gz

Download URL napari-sam-0.4.13.tar.gz
Size 23.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f1f6fe177e45a217a3fd10e3a66c2f641560b9b14e940cd00d2fbebc9f65ce5f
BLAKE2b-256 checksum
How to use checksums
093577ffc566d173f8f096923f1e4eb8cf09829fac23f225d7e342e47a48402c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / napari_sam-0.4.13-py3-none-any.whl

Download URL napari_sam-0.4.13-py3-none-any.whl
Size 23.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8c81227a55192f70f4c038f18ca46a520c078a615f9066f425b0f05a54ce2a88
BLAKE2b-256 checksum
How to use checksums
da963f41c2bf61ff70f3290dd4c2c4efc47a3fa6c4118c2b31ad235c930b41c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release history Release notifications | RSS feed

This release

0.4.13 This release

2 release files

0.4.12

2 release files

0.4.11

2 release files

0.4.9

2 release files

0.4.8

2 release files

0.4.7

2 release files

0.4.6

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.19

2 release files

0.3.18

2 release files

0.3.17

2 release files

0.3.16

2 release files

0.3.15

2 release files

0.3.14

2 release files

0.3.13

2 release files

0.3.12

2 release files

0.3.11

2 release files

0.3.10

2 release files

0.3.9

2 release files

0.3.8

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.5

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.0.1

2 release files

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