Socket
Book a DemoInstallSign in
Socket

@annotorious/plugin-segment-anything

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@annotorious/plugin-segment-anything

A smart polygon selection tool based on SegmentAnything 2

Source
npmnpm
Version
0.2.3
Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
Source

Annotorious SegmentAnything Plugin

A fully browser-based smart polygon selection tool for Annotorious based on the sam2-hiera-tiny SegmentAnything model. The basic approach is inspired by this blog post and demo code.

Demo

Important: this plugin only supports @annotorious/openseadragon at this time. Support for plain (JPEG, PNG,...) images is not yet implemented. Get in touch via the forum if you are interested in using this with the @annotorious/annotorious or @annotorious/react packages.

Using with OpenSeadragon

npm install @annotorious/plugin-segment-anything
import OpenSeadragon from 'openseadragon';
import { createOSDAnnotator } from '@annotorious/openseadragon';
import { mountOpenSeadragonPlugin } from '@annotorious/plugin-segment-anything/openseadragon';

import '@annotorious/openseadragon/annotorious-openseadragon.css';

const viewer = OpenSeadragon({
  /** init your viewer **/
});

const anno = createOSDAnnotator(viewer, { /* options */ });

// Initialize the plugin
const plugin = mountOpenSeadragonPlugin(anno);

// This will start initializing the plugin, incl.
// download of the model (this may take a while).
plugin.init();

plugin.on('downloadStart', () => {
  console.log('downloading the model - this may take a while');
});

plugin.on('downloadProgress', progress => {
  if (progress.complete)
    console.log('downloading complete');
});

plugin.on('initialized', () => {
  console.log('plugin ready');
});

plugin.on('encodingStart', () => {
  console.log('busy - encoding viewport');
});

plugin.on('encodingFinished', () => {
  console.log('ready - click to create annotation!');
});

FAQs

Package last updated on 15 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts