Views
No views yet
npm i @huggingface/transformersXenova/owlv2-base-patch16-finetuned.1import { pipeline } from '@huggingface/transformers';
2
3const detector = await pipeline('zero-shot-object-detection', 'Xenova/owlv2-base-patch16-finetuned');
4
5const url = 'http://images.cocodataset.org/val2017/000000039769.jpg';
6const candidate_labels = ['a photo of a cat', 'a photo of a dog'];
7const output = await detector(url, candidate_labels);
8console.log(output);
9// [
10// { score: 0.6951543688774109, label: 'a photo of a cat', box: { xmin: 326, ymin: 23, xmax: 650, ymax: 376 } },
11// { score: 0.5766839385032654, label: 'a photo of a cat', box: { xmin: 6, ymin: 63, xmax: 315, ymax: 487 } }
12// ]
onnx).