Views
No views yet
npm i @huggingface/transformersXenova/detr-resnet-50.1import { pipeline } from '@huggingface/transformers';
2
3const detector = await pipeline('object-detection', 'Xenova/detr-resnet-50');
4
5const img = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/cats.jpg';
6const output = await detector(img, { threshold: 0.9 });
7// [{
8// "score": 0.9976370930671692,
9// "label": "remote",
10// "box": { "xmin": 31, "ymin": 68, "xmax": 190, "ymax": 118 }
11// },
12// ...
13// {
14// "score": 0.9984092116355896,
15// "label": "cat",
16// "box": { "xmin": 331, "ymin": 19, "xmax": 649, "ymax": 371 }
17// }]
onnx).