Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (16.6%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

Basic Info
  • Host: GitHub
  • Owner: hiroalchem
  • License: apache-2.0
  • Language: Python
  • Default Branch: main
  • Size: 48.8 KB
Statistics
  • Stars: 28
  • Watchers: 1
  • Forks: 2
  • Open Issues: 0
  • Releases: 1
Created almost 3 years ago · Last pushed 7 months ago
Metadata Files
Readme License Citation

README.md

napari-SAM4IS

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

napari plugin for instance and semantic segmentation annotation using Segment Anything Model (SAM)

This is a plugin for napari, a multi-dimensional image viewer for Python, that allows for instance and semantic segmentation annotation. This plugin provides an easy-to-use interface for annotating images with the option to output annotations as COCO format.


This napari plugin was generated with Cookiecutter using @napari's cookiecutter-napari-plugin template.

Installation

Step 1: Install napari-SAM4IS

You can install napari-SAM4IS via pip:

bash pip install napari-SAM4IS

Or via conda:

bash conda install -c conda-forge napari-SAM4IS

To install the latest development version:

bash pip install git+https://github.com/hiroalchem/napari-SAM4IS.git

Step 2: Install Segment Anything Model (Optional - for local model usage)

Note: Installing the Segment Anything Model is only required if you plan to use local models. If you're using the API mode, you can skip this step.

To use local models, install SAM:

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

Or you can install from source by cloning the repository:

bash git clone https://github.com/facebookresearch/segment-anything.git cd segment-anything pip install -e .

For more detailed instructions, please refer to the SAM installation guide.

Usage

Preparation

  1. Open an image in napari and launch the plugin. (Opening an image after launching the plugin is also possible.)
  2. Upon launching the plugin, three layers will be automatically created: SAM-Box, SAM-Predict, and Accepted. The usage of these layers will be explained later.
  3. Choose between local model or API mode:
    • Local Model Mode: Select the model you want to use and click the load button. (The default option is recommended.)
    • API Mode: Check the "Use API" checkbox, then enter your API URL and API Key. No model loading is required.
  4. Next, select the image layer you want to annotate.
  5. Then, select whether you want to do instance segmentation or semantic segmentation. (Note that for 3D images, semantic segmentation should be chosen in the current version.)
  6. Finally, select the output layer as "shapes" for instance segmentation or "labels" for semantic segmentation. (For instance segmentation, the "Accept" layer can also be used.)

Annotation

  1. Select the SAM-Box layer and use the rectangle tool to enclose the object you want to segment.
  2. An automatic segmentation mask will be created and output to the SAM-Predict layer.
  3. If you want to make adjustments, do so in the SAM-Predict layer.
  4. To accept or reject the annotation, press "a" or "r" on the keyboard, respectively.
  5. If you accept the annotation, it will be output as label 1 for semantic segmentation or converted to a polygon and output to the designated layer for instance segmentation.
  6. If you reject the annotation, the segmentation mask in the SAM-Predict layer will be discarded.
  7. After accepting or rejecting the annotation, the SAM-Predict layer will automatically reset to blank and return to the SAM-Box layer.

Saving

  1. If you have output to the labels layer, use napari's standard functionality to save the mask.
  2. If you have output to the shapes layer, you can save the shapes layer using napari's standard functionality, or you can click the "save" button to output a JSON file in COCO format for each image in the folder. (The JSON file will have the same name as the image.)

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-SAM4IS" is free and open source software

Issues

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

Owner

  • Login: hiroalchem
  • Kind: user

Citation (CITATION.cff)

# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: napari-sam4IS
message: >-
  If you use this software, please cite it using the
  metadata from this file.
type: software
authors:
  - given-names: Hiroki
    family-names: Kawai
    email: h.kawai888@gmail.com
    orcid: 'https://orcid.org/0000-0002-7129-2384'
repository-code: 'https://github.com/hiroalchem/napari-SAM4IS'
url: 'https://www.napari-hub.org/plugins/napari-SAM4IS'
abstract: >-
  napari plugin for instance and semantic segmentation
  annotation using Segment Anything Model (SAM)
license: Apache-2.0
version: 0.0.6

GitHub Events

Total
  • Create event: 2
  • Release event: 1
  • Issues event: 1
  • Watch event: 4
  • Delete event: 5
  • Issue comment event: 4
  • Push event: 14
  • Pull request review comment event: 13
  • Pull request review event: 8
  • Pull request event: 5
Last Year
  • Create event: 2
  • Release event: 1
  • Issues event: 1
  • Watch event: 4
  • Delete event: 5
  • Issue comment event: 4
  • Push event: 14
  • Pull request review comment event: 13
  • Pull request review event: 8
  • Pull request event: 5

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 1
  • Total pull requests: 4
  • Average time to close issues: N/A
  • Average time to close pull requests: less than a minute
  • Total issue authors: 1
  • Total pull request authors: 1
  • Average comments per issue: 1.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 4
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • Shogosuga (1)
Pull Request Authors
  • hiroalchem (8)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 40 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 9
  • Total maintainers: 1
pypi.org: napari-sam4is

Create annotations for instance segmentation using Segment Anything models

  • Versions: 9
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 40 Last month
Rankings
Dependent packages count: 7.2%
Downloads: 14.1%
Average: 23.5%
Forks count: 30.5%
Stargazers count: 32.4%
Dependent repos count: 33.4%
Maintainers (1)
Last synced: 6 months ago

Dependencies

.github/workflows/test_and_deploy.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • aganders3/headless-gui v1 composite
  • codecov/codecov-action v3 composite
  • tlambert03/setup-qt-libs v1 composite
pyproject.toml pypi