https://huggingface.co/hustvl/yolos-tiny with ONNX weights to be compatible with Transformers.js.

Usage (Transformers.js)

If you haven't already, you can install the Transformers.js JavaScript library from NPM using:

npm i @huggingface/transformers

Example: Perform object detection with Xenova/yolos-tiny.

import { pipeline } from "@huggingface/transformers";

const detector = await pipeline("object-detection", "Xenova/yolos-tiny");

const image = "https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/cats.jpg";
const output = await detector(image, { threshold: 0.9 });
console.log(output);
Example 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 },
  },
]

Note: Having a separate repo for ONNX weights is intended to be a temporary solution until WebML gains more traction. If you would like to make your models web-ready, we recommend converting to ONNX using 🤗 Optimum and structuring your repo like this one (with ONNX weights located in a subfolder named onnx).

Downloads last month
389
Inference Examples
Inference API (serverless) does not yet support transformers.js models for this pipeline type.

Model tree for Xenova/yolos-tiny

Base model

hustvl/yolos-tiny
Quantized
(1)
this model

Spaces using Xenova/yolos-tiny 4