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

Add support for owlv2 models #579

Merged
merged 1 commit into from
Feb 19, 2024
Merged

Add support for owlv2 models #579

merged 1 commit into from
Feb 19, 2024

Conversation

xenova
Copy link
Collaborator

@xenova xenova commented Feb 9, 2024

Example: Zero-shot object detection w/ Xenova/owlv2-base-patch16-ensemble.

import { pipeline } from '@xenova/transformers';

const detector = await pipeline('zero-shot-object-detection', 'Xenova/owlv2-base-patch16-ensemble');

const url = 'http://images.cocodataset.org/val2017/000000039769.jpg';
const candidate_labels = ['a photo of a cat', 'a photo of a dog'];
const output = await detector(url, candidate_labels);
console.log(output);
// [
//   { score: 0.7400985360145569, label: 'a photo of a cat', box: { xmin: 0, ymin: 50, xmax: 323, ymax: 485 } },
//   { score: 0.6315087080001831, label: 'a photo of a cat', box: { xmin: 333, ymin: 23, xmax: 658, ymax: 378 } }
// ]

image/png

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@xenova xenova merged commit 5ac17bd into main Feb 19, 2024
4 checks passed
@xenova xenova deleted the add-owlv2 branch February 19, 2024 12:57
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

Successfully merging this pull request may close these issues.

2 participants