Model for use with Autodistill
Project description
⚠️ This is an example README for use in creating a Base Model. You will need to adjust this document for the model you are using.
Autodistill Grounded EdgeSAM Module
This repository contains the code supporting the Grounded EdgeSAM base model for use with Autodistill.
EdgeSAM, introduced in the "EdgeSAM: Prompt-In-the-Loop Distillation for On-Device Deployment of SAM" paper, is a faster version of the Segment Anything model.
Grounded EdgeSAM combines Grounding DINO and EdgeSAM, allowing you to identify objects and generate segmentation masks for them.
Read the full Autodistill documentation to learn more about Autodistill.
Installation
To use Grounded EdgeSAM with autodistill, you need to install the following dependency:
pip3 install autodistill-grounded-edgesam
Quickstart
from autodistill_clip import CLIP
# define an ontology to map class names to our GroundingDINO prompt
# the ontology dictionary has the format {caption: class}
# where caption is the prompt sent to the base model, and class is the label that will
# be saved for that caption in the generated annotations
# then, load the model
from autodistill_grounded_edgesam import GroundedEdgeSAM
from autodistill.detection import CaptionOntology
from autodistill.utils import plot
import cv2
# define an ontology to map class names to our GroundedSAM prompt
# the ontology dictionary has the format {caption: class}
# where caption is the prompt sent to the base model, and class is the label that will
# be saved for that caption in the generated annotations
# then, load the model
base_model = GroundedEdgeSAM(
ontology=CaptionOntology(
{
"person": "person",
"forklift": "forklift",
}
)
)
# run inference on a single image
results = base_model.predict("logistics.jpeg")
plot(
image=cv2.imread("logistics.jpeg"),
classes=base_model.ontology.classes(),
detections=results
)
# label a folder of images
base_model.label("./context_images", extension=".jpeg")
License
This repository is released under an S-Lab License 1.0 license.
🏆 Contributing
We love your input! Please see the core Autodistill contributing guide to get started. Thank you 🙏 to all our contributors!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file autodistill-grounded-edgesam-0.1.0.tar.gz
.
File metadata
- Download URL: autodistill-grounded-edgesam-0.1.0.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | baa0bc0308a03cfe2392f620492565254fcaaa19ae6140782652a2e6c3f87b1e |
|
MD5 | cacfb9b0061876335558424c481c4c11 |
|
BLAKE2b-256 | 3ec4f7051a5ff31cec5946969015fb90b6fc7cce70a66275749300a074f6f444 |
File details
Details for the file autodistill_grounded_edgesam-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: autodistill_grounded_edgesam-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2a22490d24f417a39219e29ed7b1f0805627795e4e29120601f2cba392f2853 |
|
MD5 | 9ba55d28e1601627def2c381e8c75c31 |
|
BLAKE2b-256 | 0a5ca5cc54b948d90baa91a3fc5bcaddfc50563cdd20674ed5678e3811035855 |