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 free or not? #277

Closed
2 tasks done
Siwakonrome opened this issue May 27, 2024 · 5 comments
Closed
2 tasks done

It’s GroundedSAM free or not? #277

Siwakonrome opened this issue May 27, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@Siwakonrome
Copy link

Siwakonrome commented May 27, 2024

Search before asking

  • I have searched the Roboflow Notebooks issues and found no similar bug report.

Description

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))

Additional

No response

Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!
@Siwakonrome Siwakonrome added the enhancement New feature or request label May 27, 2024
@SkalskiP
Copy link
Collaborator

I'm not sure if this repository is the best place for this ticket. I recommend moving it to autodistill. To answer your question, the API_KEY is free; you only need it to download the model from Roboflow.

@Siwakonrome
Copy link
Author

Yes. I need to use it without internet in my project. If i using autodistill-grounded-sam and download model to my computer work station. That mean i can using this code without API key anymore?

@SkalskiP
Copy link
Collaborator

SkalskiP commented May 27, 2024

@Siwakonrome, Once the model is cached, you don't need the internet anymore.

@Siwakonrome
Copy link
Author

Siwakonrome commented May 28, 2024

My project cannot connect internet after deployed it on production. Thanks for your information.

@SkalskiP
Copy link
Collaborator

I'm closing the issue :)

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

No branches or pull requests

2 participants