SegMate: A Segmentation Toolkit
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
Training a prompt embedding to auto segment 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:
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')
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).
Metadata
Release files for segmate 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| segmate-0.3.1.tar.gz | 24.3 MB | Without provenance | Details for segmate-0.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| segmate-0.3.1-py3-none-any.whl | Python 3 | none | any | Details for segmate-0.3.1-py3-none-any.whl |
Total release size: 24.3 MB
Release files / segmate-0.3.1.tar.gz
| Download URL | segmate-0.3.1.tar.gz |
|---|---|
| Size | 24.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0cc66ea5a06454b826251c498e4d256ef3f3b34610f5a13c7fc4ebf2910e84fd
|
|
BLAKE2b-256 checksum How to use checksums |
bf4509eead9cfa24931a2a6ef80a9514675748238e7a5411b24ac79a644bbf66
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.13
|
Release files / segmate-0.3.1-py3-none-any.whl
| Download URL | segmate-0.3.1-py3-none-any.whl |
|---|---|
| Size | 13.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
68f83c4fa30f805741dec0fe0dd1abba0e4b42498bfe1447889fd709b9c90050
|
|
BLAKE2b-256 checksum How to use checksums |
83081e6a5ceb78d5d3ed35c93c253f81f05950199c5e30e3cfc7d703af0e0d1a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.13
|
Security for segmate 0.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.