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

Example of object detection in docs #142

Open
pavanramkumar opened this issue Oct 3, 2024 · 2 comments
Open

Example of object detection in docs #142

pavanramkumar opened this issue Oct 3, 2024 · 2 comments

Comments

@pavanramkumar
Copy link

It would be great to have a simple example of object detection in the documentation so I can reproduce it. I currently tried to use the detect method, but I'm likely using the wrong model version.

from transformers import AutoModelForCausalLM, AutoTokenizer
from PIL import Image

model_id = "vikhyatk/moondream2"
revision = "2024-07-23"
model = AutoModelForCausalLM.from_pretrained(
    model_id, trust_remote_code=True, revision=revision
)
tokenizer = AutoTokenizer.from_pretrained(model_id, revision=revision)

I load input_image with PIL. Then...

enc_image = model.encode_image(input_image)
generated_boxes = model.detect(enc_image, question, tokenizer)

returns:

AttributeError: 'Moondream' object has no attribute 'detect'
@vikhyat
Copy link
Owner

vikhyat commented Oct 16, 2024

It's not available in the latest version on Hugging Face yet, but I will share an example of how to use it from the client library shortly.

@samb271
Copy link

samb271 commented Nov 16, 2024

Hi! Any updates on this? Was wondering if moondream supports openset detections?

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

3 participants