Views
No views yet
npm i @huggingface/transformersXenova/yolos-tiny.1import { pipeline } from "@huggingface/transformers";
2const detector = await pipeline("object-detection", "Xenova/yolos-tiny");
3const image = "https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/cats.jpg";
4const output = await detector(image, { threshold: 0.9 });
5console.log(output);[
{
score: 0.9921281933784485,
label: "remote",
box: { xmin: 32, ymin: 78, xmax: 185, ymax: 117 },
},
{
score: 0.9884883165359497,
label: "remote",
box: { xmin: 324, ymin: 82, xmax: 376, ymax: 191 },
},
{
score: 0.9197800159454346,
label: "cat",
box: { xmin: 5, ymin: 56, xmax: 321, ymax: 469 },
},
{
score: 0.9300552606582642,
label: "cat",
box: { xmin: 332, ymin: 25, xmax: 638, ymax: 369 },
},
]onnx).