Giter VIP home page Giter VIP logo

semanta's Introduction

Semanta

This project is not a fork, but it refers to https://github.com/facebookresearch/segment-anything.

Overview

Semanta is a Next.js and ONNX template for developers looking to integrate Meta's SAM model for semantic segmentation into their projects with the benefits of ONNX runtime optimizations. It includes basic scaffolding for downloading images, flexibly adding labels, and generating customizable image masks.

Prerequisites

  • Node.js (our version: v18.14.0)
  • ONNX Runtime

Installation

git clone https://github.com/cantoramann/semanta.git

npm i

npx next dev

Getting Started

After trying the demo, you may want to override small steps.

Custom Images

To override custom images, refer to the segmentationImagesService.images.setImages() function in app/page.tsx. You load images from buckets such as S3 using the URLs.

Generating Embeddings for Custom Images

The applicaiton requires SAM embeddings (or any other ONNX comptabile image embedding) for each image. This can be achieved by making an external call to your model or containerizing a side service (or a Jupyter Notebook) that interacts with the app. Currently, all embedding URLs are set in the beginning of the project. This may not be efficient and possible for all use cases. This can be flexibly overridden before the runInference() function call in app/page.tsx.

Mask Colors

By default, downloaded mask colors are the same as the label colors. To keep all downloaded mask colors in black, you can use the function convertToBlackMask() in components/Segmentor/mask-utils.ts.

Generating Embeddings

To generate embedding, there are multiple models that can be used. The most popular one is SAM. In this resource, Meta shows how to use SAM for image embeddings. Semanta will work with any ONNX compatible embedding.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.