Add/update the quantized ONNX model files and README.md for Transformers.js v3 (#2)
Browse files- Add/update the quantized ONNX model files and README.md for Transformers.js v3 (2191fe1033b3f506c4f029b0f422e7b3e3b6cfeb)
Co-authored-by: Yuichiro Tachibana <[email protected]>
README.md
CHANGED
@@ -9,15 +9,15 @@ YOLOv8s-pose with ONNX weights to be compatible with Transformers.js.
|
|
9 |
|
10 |
## Usage (Transformers.js)
|
11 |
|
12 |
-
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/@
|
13 |
```bash
|
14 |
-
npm i @
|
15 |
```
|
16 |
|
17 |
**Example:** Perform pose-estimation w/ `Xenova/yolov8s-pose`.
|
18 |
|
19 |
```js
|
20 |
-
import { AutoModel, AutoProcessor, RawImage } from '@
|
21 |
|
22 |
// Load model and processor
|
23 |
const model_id = 'Xenova/yolov8s-pose';
|
@@ -57,7 +57,7 @@ for (const [xc, yc, w, h, score, ...keypoints] of permuted.tolist()) {
|
|
57 |
const y1 = (yc - h / 2) / scaledHeight * image.height;
|
58 |
const x2 = (xc + w / 2) / scaledWidth * image.width;
|
59 |
const y2 = (yc + h / 2) / scaledHeight * image.height;
|
60 |
-
results.push({ x1, x2, y1, y2, score, keypoints })
|
61 |
}
|
62 |
|
63 |
|
@@ -108,7 +108,7 @@ const filteredResults = removeDuplicates(results, iouThreshold);
|
|
108 |
|
109 |
// Display results
|
110 |
for (const { x1, x2, y1, y2, score, keypoints } of filteredResults) {
|
111 |
-
console.log(`Found person at [${x1}, ${y1}, ${x2}, ${y2}] with score ${score.toFixed(3)}`)
|
112 |
for (let i = 0; i < keypoints.length; i += 3) {
|
113 |
const label = model.config.id2label[Math.floor(i / 3)];
|
114 |
const [x, y, point_score] = keypoints.slice(i, i + 3);
|
|
|
9 |
|
10 |
## Usage (Transformers.js)
|
11 |
|
12 |
+
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:
|
13 |
```bash
|
14 |
+
npm i @huggingface/transformers
|
15 |
```
|
16 |
|
17 |
**Example:** Perform pose-estimation w/ `Xenova/yolov8s-pose`.
|
18 |
|
19 |
```js
|
20 |
+
import { AutoModel, AutoProcessor, RawImage } from '@huggingface/transformers';
|
21 |
|
22 |
// Load model and processor
|
23 |
const model_id = 'Xenova/yolov8s-pose';
|
|
|
57 |
const y1 = (yc - h / 2) / scaledHeight * image.height;
|
58 |
const x2 = (xc + w / 2) / scaledWidth * image.width;
|
59 |
const y2 = (yc + h / 2) / scaledHeight * image.height;
|
60 |
+
results.push({ x1, x2, y1, y2, score, keypoints });
|
61 |
}
|
62 |
|
63 |
|
|
|
108 |
|
109 |
// Display results
|
110 |
for (const { x1, x2, y1, y2, score, keypoints } of filteredResults) {
|
111 |
+
console.log(`Found person at [${x1}, ${y1}, ${x2}, ${y2}] with score ${score.toFixed(3)}`);
|
112 |
for (let i = 0; i < keypoints.length; i += 3) {
|
113 |
const label = model.config.id2label[Math.floor(i / 3)];
|
114 |
const [x, y, point_score] = keypoints.slice(i, i + 3);
|