CristianR8 commited on
Commit
9826636
·
verified ·
1 Parent(s): ae5efd2

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +57 -0
README.md ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: hustvl/yolos-tiny
3
+ library_name: transformers.js
4
+ ---
5
+ https://huggingface.co/hustvl/yolos-tiny with ONNX weights to be compatible with Transformers.js.
6
+
7
+ ## Usage (Transformers.js)
8
+
9
+ If you haven't already, you can install the [Transformers.js](https://huggingface.co/docs/transformers.js) JavaScript library from [NPM](https://www.npmjs.com/package/@huggingface/transformers) using:
10
+ ```bash
11
+ npm i @huggingface/transformers
12
+ ```
13
+
14
+ **Example:** Perform object detection with `Xenova/yolos-tiny`.
15
+
16
+ ```js
17
+ import { pipeline } from "@huggingface/transformers";
18
+ const detector = await pipeline("object-detection", "Xenova/yolos-tiny");
19
+ const image = "https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/cats.jpg";
20
+ const output = await detector(image, { threshold: 0.9 });
21
+ console.log(output);
22
+ ```
23
+
24
+ <details>
25
+
26
+ <summary>Example output</summary>
27
+
28
+ ```
29
+ [
30
+ {
31
+ score: 0.9921281933784485,
32
+ label: "remote",
33
+ box: { xmin: 32, ymin: 78, xmax: 185, ymax: 117 },
34
+ },
35
+ {
36
+ score: 0.9884883165359497,
37
+ label: "remote",
38
+ box: { xmin: 324, ymin: 82, xmax: 376, ymax: 191 },
39
+ },
40
+ {
41
+ score: 0.9197800159454346,
42
+ label: "cat",
43
+ box: { xmin: 5, ymin: 56, xmax: 321, ymax: 469 },
44
+ },
45
+ {
46
+ score: 0.9300552606582642,
47
+ label: "cat",
48
+ box: { xmin: 332, ymin: 25, xmax: 638, ymax: 369 },
49
+ },
50
+ ]
51
+ ```
52
+
53
+ </details>
54
+
55
+ ---
56
+
57
+ 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](https://huggingface.co/docs/optimum/index) and structuring your repo like this one (with ONNX weights located in a subfolder named `onnx`).