Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It’s GroundedSAM always for free or not? #12

Closed
Siwakonrome opened this issue May 27, 2024 · 1 comment
Closed

It’s GroundedSAM always for free or not? #12

Siwakonrome opened this issue May 27, 2024 · 1 comment

Comments

@Siwakonrome
Copy link

It’s GroundedSAM free or not? If not How to get Api key to using this service?

import cv2
import supervision as sv
from autodistill_grounded_sam import GroundedSAM
from autodistill.detection import CaptionOntology

class GroundedSAMOperator:

def init(self, caption):
self.caption = caption
self.base_model = GroundedSAM(ontology=CaptionOntology(self.caption))
self.classes = base_model.ontology.classes()

def call(self, image):
detections = self.base_model.predict(image)
labels = [f"{self.classes[class_id]} {confidence:0.2f}" for _, _, confidence, class_id, _ in detections]
print(labels)
return detections

image = cv2.imread("/content/aluminum.jpg")
caption = { "aluminum workpiece": "aluminum" }
grounded_sam_operator = GroundedSAMOperator(caption)
detections = grounded_sam_operator(image)

mask_annotator = sv.MaskAnnotator()

annotated_frame = mask_annotator.annotate(
scene=image.copy(),
detections=detections)

sv.plot_image(annotated_frame, size=(8, 8))

@Siwakonrome Siwakonrome closed this as not planned Won't fix, can't repro, duplicate, stale Jul 22, 2024
@capjamesg
Copy link
Member

Grounded SAM is free to use on your hardware.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants