DINOSim Segmentation

A simple plugin to use DINOSim in napari

  • Aitor Gonzalez-Marfil

License: MIT DOI PyPI Python Version tests napari hub

DINOSim-simple

A napari plugin for zero-shot image segmentation using DINOv2 vision transformers.


Overview

napari-DINOSim enables zero-shot image segmentation by selecting reference points on an image. The plugin leverages DINOv2's powerful feature extraction capabilities to compute similarity maps and generate segmentation masks.

For detailed information about the widget's functionality, UI elements, and usage instructions, please refer to the Plugin Documentation. A simple example notebook and an advanced notebook are also available for programmatic use, showing how to load/save embeddings and references.

Installation

For a fresh environment, install napari-DINOSim with napari:

pip install "napari-dinosim[all]"

When napari is already installed, including through the napari plugin manager, install only the plugin:

pip install napari-dinosim

To install from source with conda:

# Clone the repository
git clone https://github.com/AAitorG/napari-DINOSim.git
cd napari-DINOSim

# Create and activate the conda environment
conda env create -f environment.yml
conda activate napari-dinosim

Note on GPU/CUDA Compatibility: The runtime will automatically fall back to CPU or Apple MPS if CUDA is unavailable. However, environment installation (e.g., via conda or pip) may still fail or produce runtime errors on older systems if the installed PyTorch wheel targets an incompatible CUDA version. If you experience GPU-related installation errors, please reinstall PyTorch with a matching CUDA build or opt for the CPU-only version from the official PyTorch guide.

Usage

To launch napari, run the following command in your terminal:

napari

Within the napari interface, go to Plugins > DINOSim Segmentation > DINOSim Widget in the menu bar. You can then:

  1. Drag and drop your image into the napari viewer
  2. Select points on the objects you want to segment
  3. The plugin will automatically generate segmentation masks based on your selections

For more detailed instructions and examples, please refer to our Plugin Documentation.

License and contributing

The code is distributed under the MIT license. Contributions are welcome. Please open an issue if you run into a problem.

Citation

Please note that DINOSim is based on a publication. If you use DINOSim in your research, please be so kind to cite our work:

@article{Gonzalez-Marfil2026dinosim,
    author = {González-Marfil, Aitor and Gómez-de-Mariscal, Estibaliz and Arganda-Carreras, Ignacio},
    title = {DINOSim: Training-Free Semantic Segmentation on Microscopy Images},
    journal = {Microscopy Research and Technique},
    year = {2026},
    doi = {https://doi.org/10.1002/jemt.70194},
}

Version:

  • 0.1.7

Last updated:

  • 2026-10-31

First released:

  • 2025-03-09

License:

  • MIT

Supported data:

  • Information not submitted

Plugin type:

Open extension:

Save extension:

Python versions supported:

    Operating system:

    • Information not submitted

    Requirements:

    • numpy>=1.21.0
    • magicgui>=0.5.0
    • qtpy
    • torch>=2.0.0
    • torchvision>=0.15.0
    • tqdm>=4.62.0
    • pillow>=9.0.0
    • matplotlib>=3.5.0
    • opencv-python
    • tifffile
    • napari
    • napari[all]; extra == "all"
    • tox; extra == "testing"
    • pytest>=8.3.5; extra == "testing"
    • pytest-qt>=4.4.0; extra == "testing"
    • pytest-xvfb>=3.0.0; extra == "testing"
    • pytest-cov>=6.0; extra == "testing"
    • pyqt5>=5.15.11; python_version < "3.11" and extra == "testing"
    • PyQt6>=6.7; python_version >= "3.11" and extra == "testing"
    • black; extra == "dev"
    • ruff; extra == "dev"
    • mypy; extra == "dev"
    • pre-commit; extra == "dev"
    Website by the napari team, original design by CZI.