detr-resnet-50 / README.md
Xenova's picture
Xenova HF staff
[Automated] Update base model metadata
ed1db44 verified
|
raw
history blame
1.8 kB
metadata
base_model: facebook/detr-resnet-50
library_name: transformers.js

https://huggingface.co/facebook/detr-resnet-50 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 @xenova/transformers

Example: Perform object-detection with Xenova/detr-resnet-50.

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

const detector = await pipeline('object-detection', 'Xenova/detr-resnet-50');

const img = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/cats.jpg';
const output = await detector(img, { threshold: 0.9 });
// [{
//   "score": 0.9976370930671692,
//   "label": "remote",
//   "box": { "xmin": 31, "ymin": 68, "xmax": 190, "ymax": 118 }
// },
// ...
// {
//   "score": 0.9984092116355896,
//   "label": "cat",
//   "box": { "xmin": 331, "ymin": 19, "xmax": 649, "ymax": 371 }
// }]

Demo

Test it out here, or create your own object-detection demo with 1 click!

image/png


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).