Factral commited on
Commit
54efc7d
·
verified ·
1 Parent(s): 82ea99c

Upload 7 files

Browse files
README.md CHANGED
@@ -1,3 +1,57 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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`).
config.json ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "CristianR8/Cacao-detection",
3
+ "architectures": [
4
+ "YolosForObjectDetection"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.0,
7
+ "auxiliary_loss": false,
8
+ "bbox_cost": 5,
9
+ "bbox_loss_coefficient": 5,
10
+ "class_cost": 1,
11
+ "eos_coefficient": 0.1,
12
+ "giou_cost": 2,
13
+ "giou_loss_coefficient": 2,
14
+ "hidden_act": "gelu",
15
+ "hidden_dropout_prob": 0.0,
16
+ "hidden_size": 192,
17
+ "id2label": {
18
+ "0": "fermentado",
19
+ "1": "insufi_fermen",
20
+ "2": "pizarroso",
21
+ "3": "hongo",
22
+ "4": "insecto",
23
+ "5": "germinado",
24
+ "6": "violeta"
25
+ },
26
+ "image_size": [
27
+ 800,
28
+ 1333
29
+ ],
30
+ "initializer_range": 0.02,
31
+ "intermediate_size": 768,
32
+ "label2id": {
33
+ "fermentado": 0,
34
+ "insufi_fermen": 1,
35
+ "pizarroso": 2,
36
+ "hongo": 3,
37
+ "insecto": 4,
38
+ "germinado": 5,
39
+ "violeta": 6
40
+ },
41
+ "layer_norm_eps": 1e-12,
42
+ "model_type": "yolos",
43
+ "num_attention_heads": 3,
44
+ "num_channels": 3,
45
+ "num_detection_tokens": 100,
46
+ "num_hidden_layers": 12,
47
+ "patch_size": 16,
48
+ "qkv_bias": true,
49
+ "transformers_version": "4.33.0.dev0",
50
+ "use_mid_position_embeddings": false
51
+ }
onnx/model.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7cef0d068b114c3076293b8ba8d985561d6d1dbf1db35455919cd0e2c93b5870
3
+ size 10571795
onnx/model_fp16.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3313a6bc63f30ee27bc2bda63a0b8109d8409fba5706cecbafabd3e8a1d69284
3
+ size 5329879
onnx/model_quantized.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7dc437512a2fb98fbfc5692e58b757599a475961aa8b2187a58d373d4cefd85e
3
+ size 2977584
preprocessor_config.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "do_normalize": false,
3
+ "do_pad": false,
4
+ "do_rescale": true,
5
+ "do_resize": true,
6
+ "feature_extractor_type": "ImageFeatureExtractor",
7
+ "resample": 2,
8
+ "rescale_factor": 0.00392156862745098,
9
+ "size": {
10
+ "width": 608,
11
+ "height": 608
12
+ }
13
+ }
quantize_config.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "per_channel": true,
3
+ "reduce_range": true,
4
+ "per_model_config": {
5
+ "model": {
6
+ "op_types": [
7
+ "Split",
8
+ "Concat",
9
+ "MaxPool",
10
+ "Slice",
11
+ "Resize",
12
+ "Softmax",
13
+ "Sigmoid",
14
+ "Conv",
15
+ "Reshape",
16
+ "Mul",
17
+ "Sub",
18
+ "Transpose",
19
+ "MatMul",
20
+ "Div",
21
+ "Add"
22
+ ],
23
+ "weight_type": "QUInt8"
24
+ }
25
+ }
26
+ }