Git Product home page Git Product logo

segmate's Introduction

SegMate: A Segmentation Toolkit

Documentation Status License

This repository is a toolkit for using the Segment Anything Model (SAM) developed by Meta AI. It is capable of accurately "cutting out" any object from an image with just a single click.

SAM is a promptable segmentation system that exhibits zero-shot generalization to unfamiliar objects and images, eliminating the need for additional training. By providing prompts that specify what needs to be segmented in an image, SAM can perform a wide range of segmentation tasks without requiring additional training.

Features

  • Easy inference with SAM, supporting bounding boxes, points, masks, and text prompts
  • Automatic mask generation
  • Finetune SAM on custom datasets
  • GroundingDINO integration for text prompt segmentation
  • Training a custom decoder to auto segment a specific type of object
  • Prompt-Tuning SAM: Training a prompt embedding that segments a specific type of object

Installation

First, install groundingdino from its repository, this is a dependency for segmate:

NOTE: There is an issue with the setup script in the GroundingDINO repository causing it not able to install torch properly, please manually install PyTorch for now. For other issues, refer to the installation guide:

pip install -U git+https://github.com/IDEA-Research/GroundingDINO.git

Then, install segmate from PyPI:

pip install segmate

Example Usage

To use the provided code snippets, follow the steps below:

  1. Import the required modules and initialize the necessary objects:
import torch

from segmate.segmenter import SAM
from segmate.object_detector import GroundingDINO
import segmate.utils as utils

# Model checkpoint path for GroundingDINO is optional. If no path provided, it will download from HuggingFace
od = GroundingDINO(device='cuda', ckpt_path='PATH_TO_CHECKPOINT')
sm = SAM(model_type='MODEL_TYPE', checkpoint='PATH_to_CHECKPOINT', device='cuda')
  1. Perform segmentation with bounding box prompts:
masks = sm.segment(image=input_image, boxes_prompt=bbox)
utils.show_masks(image, masks)

Documentation

Detailed package documentation: SegMate Docs

If you have any questions or need assistance, please don't hesitate to reach out to our support team or join our community forum. We hope you find this toolkit valuable and look forward to seeing the incredible applications you create with SAM!

License

The code in this repository is published under 3-Clause BSD license (see LICENSE file).

segmate's People

Contributors

xkunw avatar vahid0001 avatar

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.