@ultralytics/yolo 0.0.31 → 0.0.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,9 +1,25 @@
1
1
  <!-- Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license -->
2
2
 
3
- <a href="https://www.ultralytics.com/"><img src="https://raw.githubusercontent.com/ultralytics/assets/main/logo/Ultralytics_Logotype_Original.svg" width="320" alt="Ultralytics logo"></a>
3
+ <div align="center">
4
+ <p>
5
+ <a href="https://www.ultralytics.com/events/yolovision?utm_source=github&utm_medium=social&utm_campaign=yolovision26&utm_content=banner" target="_blank">
6
+ <img width="100%" src="https://raw.githubusercontent.com/ultralytics/assets/main/yolov8/banner-yolov8.png" alt="Ultralytics YOLO banner"></a>
7
+ </p>
8
+
9
+ [中文](https://docs.ultralytics.com/zh) | [한국어](https://docs.ultralytics.com/ko) | [日本語](https://docs.ultralytics.com/ja) | [Русский](https://docs.ultralytics.com/ru) | [Deutsch](https://docs.ultralytics.com/de) | [Français](https://docs.ultralytics.com/fr) | [Español](https://docs.ultralytics.com/es) | [Português](https://docs.ultralytics.com/pt) | [Türkçe](https://docs.ultralytics.com/tr) | [Tiếng Việt](https://docs.ultralytics.com/vi) | [العربية](https://docs.ultralytics.com/ar) <br>
10
+
11
+ </div>
4
12
 
5
13
  # Ultralytics YOLO npm Inference
6
14
 
15
+ <div align="center">
16
+
17
+ [English](README.md) | [简体中文](README.zh-CN.md)
18
+
19
+ </div>
20
+
21
+ <div align="center">
22
+
7
23
  [![npm version](https://img.shields.io/npm/v/@ultralytics/yolo?logo=npm&logoColor=white&label=npm&color=CB3837)](https://www.npmjs.com/package/@ultralytics/yolo)
8
24
  [![npm downloads](https://img.shields.io/npm/dm/@ultralytics/yolo?logo=npm&logoColor=white&label=downloads&color=CB3837)](https://www.npmjs.com/package/@ultralytics/yolo)
9
25
  [![CI](https://github.com/ultralytics/inference/actions/workflows/ci.yml/badge.svg)](https://github.com/ultralytics/inference/actions/workflows/ci.yml)
@@ -14,10 +30,12 @@
14
30
  [![Ultralytics Forums](https://img.shields.io/discourse/users?server=https%3A%2F%2Fcommunity.ultralytics.com&logo=discourse&label=Forums&color=blue)](https://community.ultralytics.com/)
15
31
  [![Ultralytics Reddit](https://img.shields.io/reddit/subreddit-subscribers/ultralytics?style=flat&logo=reddit&logoColor=white&label=Reddit&color=blue)](https://www.reddit.com/r/Ultralytics/)
16
32
 
33
+ </div>
34
+
17
35
  Run [Ultralytics](https://www.ultralytics.com/) YOLO models directly in the browser,
18
36
  with no server and no Python. It runs on **WebGPU** (with an automatic CPU/wasm
19
- fallback) and covers detection, segmentation, pose, classification, OBB, and
20
- semantic segmentation, behind a small TypeScript API with a built-in
37
+ fallback) and covers detection, segmentation, pose, classification, OBB,
38
+ semantic segmentation, and depth estimation, behind a small TypeScript API with a built-in
21
39
  `annotate()` that draws results straight to a canvas.
22
40
 
23
41
  ```ts
@@ -107,8 +125,14 @@ async function frame() {
107
125
 
108
126
  Runs [Ultralytics YOLOv8](https://docs.ultralytics.com/models/yolov8),
109
127
  [Ultralytics YOLO11](https://docs.ultralytics.com/models/yolo11), and
110
- [Ultralytics YOLO26](https://docs.ultralytics.com/models/yolo26) ONNX exports for detection,
111
- segmentation, pose, OBB, classification, and semantic segmentation.
128
+ [Ultralytics YOLO26](https://docs.ultralytics.com/models/yolo26) ONNX exports for
129
+ [detection](https://docs.ultralytics.com/tasks/detect),
130
+ [segmentation](https://docs.ultralytics.com/tasks/segment),
131
+ [pose](https://docs.ultralytics.com/tasks/pose),
132
+ [OBB](https://docs.ultralytics.com/tasks/obb),
133
+ [classification](https://docs.ultralytics.com/tasks/classify),
134
+ [semantic segmentation](https://docs.ultralytics.com/tasks/semantic), and
135
+ [depth estimation](https://docs.ultralytics.com/tasks/depth).
112
136
 
113
137
  Pass a bare ONNX name and it is **auto-downloaded** from the
114
138
  [Ultralytics assets release](https://github.com/ultralytics/assets/releases) (the
@@ -119,8 +143,9 @@ await YOLO.load("yolo26n.onnx"); // auto-downloads from the release: .../downloa
119
143
  ```
120
144
 
121
145
  Auto-download covers **Ultralytics YOLO26**, **Ultralytics YOLO11**, and **Ultralytics YOLOv8** in sizes `n/s/m/l/x`
122
- with task suffixes `-seg`, `-pose`, `-cls`, `-obb`, and `-sem` (semantic, Ultralytics YOLO26
123
- only). A value containing a `/` or a scheme is used as a URL/path as-is.
146
+ with task suffixes `-seg`, `-pose`, `-cls`, `-obb`, `-sem` (semantic), and `-depth` (depth
147
+ estimation) — the last two Ultralytics YOLO26 only. A value containing a `/` or a scheme is
148
+ used as a URL/path as-is.
124
149
 
125
150
  > **CORS note:** GitHub release assets do not send `Access-Control-Allow-Origin`,
126
151
  > so a browser cannot fetch them cross-origin. Host the `.onnx` **same-origin**
@@ -130,10 +155,8 @@ only). A value containing a `/` or a scheme is used as a URL/path as-is.
130
155
 
131
156
  ## 📐 Results Shape
132
157
 
133
- `predict()` resolves to a `Results` object shaped like the Ultralytics
134
- `Results`:
135
-
136
- Field names match the Rust/Ultralytics `Results` API 1-1:
158
+ `predict()` resolves to a `Results` object whose field names match the
159
+ Rust/Ultralytics `Results` API 1-1:
137
160
 
138
161
  | Field | Type | Tasks |
139
162
  | ------------------ | -------------------------------------------------------------------- | --------------------- |
@@ -0,0 +1,334 @@
1
+ <!-- Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license -->
2
+
3
+ <div align="center">
4
+ <p>
5
+ <a href="https://www.ultralytics.com/events/yolovision?utm_source=github&utm_medium=social&utm_campaign=yolovision26&utm_content=banner" target="_blank">
6
+ <img width="100%" src="https://raw.githubusercontent.com/ultralytics/assets/main/yolov8/banner-yolov8.png" alt="Ultralytics YOLO 横幅"></a>
7
+ </p>
8
+
9
+ [中文](https://docs.ultralytics.com/zh) | [한국어](https://docs.ultralytics.com/ko) | [日本語](https://docs.ultralytics.com/ja) | [Русский](https://docs.ultralytics.com/ru) | [Deutsch](https://docs.ultralytics.com/de) | [Français](https://docs.ultralytics.com/fr) | [Español](https://docs.ultralytics.com/es) | [Português](https://docs.ultralytics.com/pt) | [Türkçe](https://docs.ultralytics.com/tr) | [Tiếng Việt](https://docs.ultralytics.com/vi) | [العربية](https://docs.ultralytics.com/ar) <br>
10
+
11
+ </div>
12
+
13
+ # Ultralytics YOLO npm Inference
14
+
15
+ <div align="center">
16
+
17
+ [English](README.md) | [简体中文](README.zh-CN.md)
18
+
19
+ </div>
20
+
21
+ <div align="center">
22
+
23
+ [![npm version](https://img.shields.io/npm/v/@ultralytics/yolo?logo=npm&logoColor=white&label=npm&color=CB3837)](https://www.npmjs.com/package/@ultralytics/yolo)
24
+ [![npm downloads](https://img.shields.io/npm/dm/@ultralytics/yolo?logo=npm&logoColor=white&label=downloads&color=CB3837)](https://www.npmjs.com/package/@ultralytics/yolo)
25
+ [![CI](https://github.com/ultralytics/inference/actions/workflows/ci.yml/badge.svg)](https://github.com/ultralytics/inference/actions/workflows/ci.yml)
26
+ [![License](https://img.shields.io/npm/l/@ultralytics/yolo?label=license&color=blue)](https://github.com/ultralytics/inference/blob/main/LICENSE)
27
+ [![arXiv](https://img.shields.io/badge/arXiv-2606.03748-b31b1b?logo=arxiv&logoColor=white)](https://arxiv.org/abs/2606.03748)
28
+
29
+ [![Ultralytics Discord](https://img.shields.io/discord/1089800235347353640?logo=discord&logoColor=white&label=Discord&color=blue)](https://discord.com/invite/ultralytics)
30
+ [![Ultralytics Forums](https://img.shields.io/discourse/users?server=https%3A%2F%2Fcommunity.ultralytics.com&logo=discourse&label=Forums&color=blue)](https://community.ultralytics.com/)
31
+ [![Ultralytics Reddit](https://img.shields.io/reddit/subreddit-subscribers/ultralytics?style=flat&logo=reddit&logoColor=white&label=Reddit&color=blue)](https://www.reddit.com/r/Ultralytics/)
32
+
33
+ </div>
34
+
35
+ 直接在浏览器中运行 [Ultralytics](https://www.ultralytics.com/) YOLO 模型,无需服务器,也无需
36
+ Python。本库基于 **WebGPU**(并自动回退到 CPU/wasm),支持检测、分割、姿态、分类、OBB、语义分割和
37
+ 深度估计,接口是一个小巧的 TypeScript API,内置的 `annotate()` 可直接把结果绘制到 canvas 上。
38
+
39
+ ```ts
40
+ import { YOLO, annotate } from "@ultralytics/yolo";
41
+
42
+ const model = await YOLO.load("yolo26n.onnx");
43
+ const results = await model.predict("bus.jpg");
44
+ await annotate(document.querySelector("canvas"), "bus.jpg", results);
45
+ ```
46
+
47
+ 本包**仅为库**(不含 CLI,CLI 属于原生 Rust crate)。底层引擎是编译为 WebAssembly 的
48
+ `ultralytics-inference` Rust crate。推理通过
49
+ [`ort-web`](https://ort.pyke.io/backends/web) 运行在
50
+ [ONNX Runtime Web](https://onnxruntime.ai/docs/tutorials/web/) 上,所有前处理/后处理、
51
+ 配色和姿态骨架都来自同一份共享 Rust 代码,因此结果和视觉效果与原生及 Python 路径保持一致。
52
+
53
+ ## 📦 安装
54
+
55
+ ```bash
56
+ npm install @ultralytics/yolo
57
+ # 或
58
+ pnpm add @ultralytics/yolo
59
+ yarn add @ultralytics/yolo
60
+ bun add @ultralytics/yolo
61
+ ```
62
+
63
+ 本包以 ES module 形式发布并自带 TypeScript 类型,可用于任意现代打包工具(Vite、webpack、
64
+ esbuild、Bun),也可直接通过 [esm.sh](https://esm.sh/@ultralytics/yolo) 等 CDN 使用。
65
+
66
+ ## 🚀 快速开始
67
+
68
+ ```ts
69
+ import { YOLO, annotate } from "@ultralytics/yolo";
70
+
71
+ // 首次使用时加载模型并初始化 WebGPU + ONNX Runtime Web。
72
+ const model = await YOLO.load("yolo26n.onnx");
73
+
74
+ const results = await model.predict("bus.jpg");
75
+ for (const box of results.boxes) {
76
+ console.log(box.name, box.conf.toFixed(2), [box.x1, box.y1, box.x2, box.y2]);
77
+ }
78
+
79
+ // 一次调用即可把框、OBB、姿态和标签绘制到 canvas(无需自己写 canvas 代码)。
80
+ await annotate(document.querySelector("canvas"), "bus.jpg", results);
81
+ ```
82
+
83
+ `predict()` 接受 URL/路径、`Blob`/`File`、原始编码图片字节(`Uint8Array`/`ArrayBuffer`)、
84
+ `ImageData`、`HTMLImageElement`、`HTMLCanvasElement`、`HTMLVideoElement` 或 `ImageBitmap`。
85
+
86
+ ```ts
87
+ const results = await model.predict(canvas, { conf: 0.25, iou: 0.7 });
88
+ console.log(model.device); // "webgpu" 或 "cpu"
89
+ ```
90
+
91
+ `YOLO.load` 同样接受 `Blob`/`File`,因此可以加载用户拖入或选择的模型。后端根据字节内容自动检测,
92
+ 所以同一个调用可同时处理 `.onnx` 和 `.tflite`:
93
+
94
+ ```ts
95
+ const model = await YOLO.load(fileInput.files[0]); // 拖入/选择的 .onnx 或 .tflite
96
+ ```
97
+
98
+ ### 摄像头 / 视频
99
+
100
+ 可绘制的输入源(`<video>`、canvas、`ImageBitmap`、`ImageData`)走原始像素快速路径,无需重新编码,
101
+ 因此渲染循环很流畅:
102
+
103
+ ```ts
104
+ const model = await YOLO.load("yolo26n.onnx");
105
+ async function frame() {
106
+ const results = await model.predict(video); // <video> 元素
107
+ await annotate(canvas, video, results);
108
+ requestAnimationFrame(frame);
109
+ }
110
+ ```
111
+
112
+ ## ✨ 模型
113
+
114
+ <a href="https://docs.ultralytics.com/tasks" target="_blank">
115
+ <img width="100%" src="https://raw.githubusercontent.com/ultralytics/assets/main/docs/ultralytics-yolov8-tasks-banner.avif" alt="Ultralytics YOLO 支持的任务">
116
+ </a>
117
+ <br>
118
+ <br>
119
+
120
+ 可运行 [Ultralytics YOLOv8](https://docs.ultralytics.com/models/yolov8)、
121
+ [Ultralytics YOLO11](https://docs.ultralytics.com/models/yolo11) 和
122
+ [Ultralytics YOLO26](https://docs.ultralytics.com/models/yolo26) 的 ONNX 导出模型,覆盖
123
+ [检测](https://docs.ultralytics.com/tasks/detect)、
124
+ [分割](https://docs.ultralytics.com/tasks/segment)、
125
+ [姿态](https://docs.ultralytics.com/tasks/pose)、
126
+ [OBB](https://docs.ultralytics.com/tasks/obb)、
127
+ [分类](https://docs.ultralytics.com/tasks/classify)、
128
+ [语义分割](https://docs.ultralytics.com/tasks/semantic)和
129
+ [深度估计](https://docs.ultralytics.com/tasks/depth)。
130
+
131
+ 传入不含路径的 ONNX 文件名时会从
132
+ [Ultralytics assets release](https://github.com/ultralytics/assets/releases) **自动下载**
133
+ (与原生 crate 和 Python 使用的是同一份权重):
134
+
135
+ ```ts
136
+ await YOLO.load("yolo26n.onnx"); // 自动从 release 下载:.../download/v8.4.0/yolo26n.onnx
137
+ ```
138
+
139
+ 自动下载覆盖 **Ultralytics YOLO26**、**Ultralytics YOLO11** 和 **Ultralytics YOLOv8** 的
140
+ `n/s/m/l/x` 尺寸,任务后缀支持 `-seg`、`-pose`、`-cls`、`-obb`、`-sem`(语义分割)和
141
+ `-depth`(深度估计)——后两者仅 Ultralytics YOLO26 支持。若取值包含 `/` 或协议前缀,则会按
142
+ URL/路径原样使用。
143
+
144
+ > **CORS 提示:** GitHub release 资源不会返回 `Access-Control-Allow-Origin`,因此浏览器无法跨域
145
+ > 获取它们。请将 `.onnx` 部署在**同源**位置(例如 `YOLO.load("/models/yolo26n.onnx")`),
146
+ > 或放在启用了 CORS 的源/代理之后。当你把这些资源镜像到这类主机上时,文件名简写会很方便。
147
+
148
+ ## 📐 结果结构
149
+
150
+ `predict()` 返回的 `Results` 对象,其字段名与 Rust/Ultralytics 的 `Results` API 一一对应:
151
+
152
+ | 字段 | 类型 | 任务 |
153
+ | ------------------ | -------------------------------------------------------------------- | --------------------- |
154
+ | `task` | `string` | 全部 |
155
+ | `width` / `height` | `number` | 全部 |
156
+ | `boxes` | `{ x1, y1, x2, y2, conf, cls, name, color }[]` | detect、segment、pose |
157
+ | `obb` | `{ x, y, w, h, angle, conf, cls, name, color }[]` | obb |
158
+ | `keypoints` | `{ points: [x, y, conf][], color }[]` | pose |
159
+ | `probs` | `{ top1, top5, top1conf, top5conf, name, top5names, color } \| null` | classify |
160
+ | `masks` | `Uint8Array`(RGBA 叠加层,`width*height*4`) | segment、semantic |
161
+ | `semantic_mask` | `Uint16Array`(每像素的类别 id,`width*height`) | semantic |
162
+ | `depth` | `Uint8Array`(不透明的彩色深度图,`width*height*4`) | depth |
163
+ | `depth_range` | `[min, max]`,单位为米 | depth |
164
+ | `speed` | `{ preprocess, inference, postprocess }`,单位 ms | 全部 |
165
+
166
+ `model.names` 是类别 id 到名称的映射(相当于 Python 中的 `model.names`)。每个检测结果都带有
167
+ Ultralytics 调色板中的 `color`,`annotate()` 绘制 `masks` 叠加层和姿态骨架时,使用的每条肢体/
168
+ 关键点配色与原生渲染器完全一致。这些逻辑都没有在 JS 中重复实现。
169
+
170
+ 对于 `depth` 任务,`predict(img, { colormap, depthViz })` 用于选择配色方案(默认 `"jet"`,
171
+ 另有 `"inferno"`、`"spectral"`、`"gray"`)和归一化方式(默认 `"disparity"`,另有 `"metric"`);
172
+ `annotate()` 会以 `depthAlpha`(默认 `0.6`,设为 `1` 则显示原始深度图)把返回的深度图叠加到画面上:
173
+
174
+ ```ts
175
+ const results = await model.predict(img, { colormap: "spectral", depthViz: "metric" });
176
+ await annotate(canvas, img, results, { depthAlpha: 0.6 });
177
+ ```
178
+
179
+ ## ⚙️ 环境要求与注意事项
180
+
181
+ - **WebGPU**(Chrome/Edge,或启用了 WebGPU 的 Firefox)配合**安全上下文**(`https://` 或
182
+ `http://localhost`)可获得快速路径。在没有 WebGPU 的环境(较旧的浏览器、部分手机)中,
183
+ `YOLO.load` 会自动回退到通用的 **CPU/wasm** 构建,随处可用。可通过
184
+ `YOLO.load("yolo26n.onnx", { device: "webgpu" | "cpu" })` 指定设备(默认 `"auto"`)。若 WebGPU
185
+ 无法启用,加载会回退到 CPU;`model.device` 会报告实际使用的设备。
186
+ - **模型格式**:请使用 Ultralytics 导出为 ONNX,以便元数据(任务、类别名称、`imgsz`)被嵌入模型:
187
+
188
+ ```python
189
+ from ultralytics import YOLO
190
+
191
+ YOLO("yolo26n.pt").export(format="onnx") # FP32(默认)
192
+ YOLO("yolo26n.pt").export(format="onnx", quantize=16) # FP16(体积约小 50%)
193
+ ```
194
+
195
+ > Ultralytics ≥8.4 使用 `quantize` 参数,取代已弃用的 `half=True` / `int8=True` 标志。
196
+ > 对于 ONNX,支持的取值为 `32`/`fp32`(默认)、`16`/`fp16` 和 `8`/`int8`。
197
+
198
+ - **运行时资源**:首次加载时,`ort-web` 会从 `cdn.pyke.io` 获取 ONNX Runtime Web 的 wasm 包
199
+ (约 25 MB,之后由浏览器缓存)。如果你设置了 Content-Security-Policy,请在
200
+ `script-src`/`connect-src` 中放行该源。若想完全避开 CDN,可自行托管运行时并指向它:
201
+ ```ts
202
+ const model = await YOLO.load("yolo26n.onnx", { ortBaseUrl: "/ort/" });
203
+ ```
204
+ 该目录需包含 ONNX Runtime Web 的入口脚本(`ort.webgpu.min.js`,以及 CPU 回退所需的
205
+ `ort.wasm.min.js`)和 `ort-wasm-simd-threaded.{jsep,asyncify,}.{mjs,wasm}` 二进制文件。
206
+ - **遥测**:`ort-web` 会在首次创建会话时向 pyke 上报页面域名。查看或关闭的方法见
207
+ [ort-web 文档](https://ort.pyke.io/backends/web)。
208
+
209
+ ## ⚡ LiteRT.js 后端
210
+
211
+ 这是一个可选的推理引擎,通过 [**LiteRT.js**](https://developers.google.com/edge/litert/web)
212
+ (Google 面向 Web 的 LiteRT)运行 Ultralytics 导出的 **`.tflite`** 模型,在 WebGPU 上
213
+ **通常比 ONNX Runtime Web 快约 2 倍**。只有推理引擎发生变化,前处理、后处理、绘制和 `Results`
214
+ 结构仍是同一份共享 Rust 代码,因此输出与 `ort` 路径一致。
215
+
216
+ 后端根据文件扩展名选择:`.tflite` 使用 LiteRT.js,`.onnx` 使用 ONNX Runtime Web。LiteRT.js 的
217
+ wasm 默认从 CDN 加载,因此唯一需要做的就是让 `@litertjs/core` 能被解析(连同它的
218
+ `@litertjs/wasm-utils` 依赖,npm 会自动安装,下面的 import map 中也显式列出)。
219
+
220
+ **使用 npm(配合打包工具):**
221
+
222
+ ```bash
223
+ npm install @ultralytics/yolo @litertjs/core
224
+ ```
225
+
226
+ ```ts
227
+ import { YOLO, annotate } from "@ultralytics/yolo";
228
+
229
+ const model = await YOLO.load("/models/yolo26n.tflite"); // .tflite -> LiteRT.js
230
+ const results = await model.predict("bus.jpg");
231
+ await annotate(document.querySelector("canvas"), "bus.jpg", results);
232
+ ```
233
+
234
+ **无需构建步骤(CDN):** 把模块映射到 CDN,然后使用与上面完全相同的代码:
235
+
236
+ ```html
237
+ <script type="importmap">
238
+ {
239
+ "imports": {
240
+ "@ultralytics/yolo": "https://esm.sh/@ultralytics/yolo",
241
+ "@litertjs/core": "https://esm.sh/@litertjs/core",
242
+ "@litertjs/wasm-utils": "https://esm.sh/@litertjs/wasm-utils"
243
+ }
244
+ }
245
+ </script>
246
+ ```
247
+
248
+ 对于摄像头或视频,每帧传入 `<video>` 元素即可:
249
+
250
+ ```ts
251
+ const results = await model.predict(video);
252
+ await annotate(canvas, video, results);
253
+ ```
254
+
255
+ wasm 默认从 jsDelivr CDN 加载;向 `YOLO.load` 传入 `litertWasmUrl: "/litert/"` 可自行托管
256
+ (复制 `node_modules/@litertjs/core/wasm/` 即可)。
257
+
258
+ 注意事项:
259
+
260
+ - **模型**:使用 Ultralytics 导出为 `.tflite`(WebGPU 需要 float32)。模型从单个文件加载,
261
+ 元数据(任务、类别名称、`imgsz`、stride)直接从 `.tflite` 中读取,与 `.onnx` 路径相同,
262
+ 无需额外的附属文件。
263
+ - **需要 Ultralytics `>= 8.4.83`**:带内嵌元数据的单文件 LiteRT 导出自
264
+ [v8.4.83](https://github.com/ultralytics/ultralytics/releases/tag/v8.4.83) 起提供。更早的版本
265
+ 会导出旧版 TFLite 格式,无法在这里加载。
266
+ - **导出非 end2end 模型**(`end2end=False`):Ultralytics YOLO26 默认使用端到端、无 NMS 的检测头,
267
+ 其中的 `int64` / `gather_nd` 算子无法在 LiteRT 的 **WebGPU** delegate 上运行,因此这类导出会
268
+ 静默回退到 CPU/wasm。请使用 `end2end=False` 导出,以便使用标准检测头,并由本包的 Rust 代码执行
269
+ NMS,从而让推理保持在 WebGPU 上:
270
+
271
+ ```bash
272
+ yolo export model=yolo26n.pt format=litert end2end=False
273
+ ```
274
+
275
+ 如果仍然加载了 end2end 的 `.tflite`,后端会自动切换到 wasm(较慢)并打印警告,而不是返回空结果。
276
+
277
+ - **支持的任务**:detect、segment、pose、obb、classify 和 semantic 均已支持。
278
+ - **跨源隔离**:LiteRT 的多线程 wasm 需要 `SharedArrayBuffer`,因此请以
279
+ `Cross-Origin-Opener-Policy: same-origin` 和 `Cross-Origin-Embedder-Policy: require-corp`
280
+ 提供服务。
281
+
282
+ ## 🔨 从源码构建
283
+
284
+ 本包使用 [`wasm-pack`](https://github.com/wasm-bindgen/wasm-pack) 从 Rust crate 构建 wasm:
285
+
286
+ ```bash
287
+ npm run build # wasm-pack build + tsc
288
+ ```
289
+
290
+ 构建完成后,在 `localhost`(安全上下文)上以上述两个跨源隔离响应头提供服务,然后用支持 WebGPU 的
291
+ 浏览器打开。
292
+
293
+ ## 💡 贡献
294
+
295
+ Ultralytics 依靠社区协作持续发展,我们重视每一份贡献。无论是报告 bug、提出功能建议,还是提交代码改动,都欢迎参与。
296
+
297
+ - **报告问题**:[打开 issue](https://github.com/ultralytics/inference/issues)。
298
+ - **功能请求**:[提交想法](https://github.com/ultralytics/inference/issues)。
299
+ - **Pull Request**:请先阅读[贡献指南](https://docs.ultralytics.com/help/contributing)。
300
+ - **反馈**:填写 [Ultralytics 调查问卷](https://www.ultralytics.com/survey?utm_source=github&utm_medium=social&utm_campaign=Survey)。
301
+
302
+ 感谢所有贡献者!你们的努力让 Ultralytics 工具持续变得更好。
303
+
304
+ [![Ultralytics 开源贡献者](https://raw.githubusercontent.com/ultralytics/assets/main/im/image-contributors.png)](https://github.com/ultralytics/ultralytics/graphs/contributors)
305
+
306
+ ## 📜 许可证
307
+
308
+ Ultralytics 提供两种许可方式:
309
+
310
+ - **AGPL-3.0 许可证**:经 [OSI 批准](https://opensource.org/license/agpl-3.0)的开源许可证,适合学生、研究者和爱好者,鼓励开放协作和知识共享。完整详情请参阅 [LICENSE](https://github.com/ultralytics/inference/blob/main/LICENSE) 文件。
311
+ - **Ultralytics 企业许可证**:面向商业使用,允许将 Ultralytics 软件和 AI 模型集成到商业产品与服务中,而无需遵循 AGPL-3.0 的开源要求。如需商业部署,请通过 [Ultralytics Licensing](https://www.ultralytics.com/license) 联系我们。
312
+
313
+ ## 📮 联系方式
314
+
315
+ - **GitHub Issues**:[bug 报告和功能请求](https://github.com/ultralytics/inference/issues)。
316
+ - **Discord**:[加入社区](https://discord.com/invite/ultralytics)。
317
+ - **文档**:[docs.ultralytics.com](https://docs.ultralytics.com)。
318
+
319
+ <br>
320
+ <div align="center">
321
+ <a href="https://github.com/ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-github.png" width="3%" alt="Ultralytics GitHub"></a>
322
+ <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
323
+ <a href="https://www.linkedin.com/company/ultralytics/"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-linkedin.png" width="3%" alt="Ultralytics LinkedIn"></a>
324
+ <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
325
+ <a href="https://x.com/ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-twitter.png" width="3%" alt="Ultralytics Twitter"></a>
326
+ <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
327
+ <a href="https://www.youtube.com/ultralytics?sub_confirmation=1"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-youtube.png" width="3%" alt="Ultralytics YouTube"></a>
328
+ <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
329
+ <a href="https://www.tiktok.com/@ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-tiktok.png" width="3%" alt="Ultralytics TikTok"></a>
330
+ <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
331
+ <a href="https://ultralytics.com/bilibili"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-bilibili.png" width="3%" alt="Ultralytics BiliBili"></a>
332
+ <img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
333
+ <a href="https://discord.com/invite/ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-discord.png" width="3%" alt="Ultralytics Discord"></a>
334
+ </div>
package/dist/index.d.ts CHANGED
@@ -167,7 +167,7 @@ export declare class YOLO {
167
167
  /** Load the LiteRT (`.tflite`) backend. Metadata (task, class names, `imgsz`)
168
168
  * is read from the single `.tflite` file, the same as the `.onnx` path. */
169
169
  private static loadLiteRt;
170
- /** The model's task (`detect`, `segment`, `pose`, `classify`, `obb`, `semantic`). */
170
+ /** The model's task (`detect`, `segment`, `pose`, `classify`, `obb`, `semantic`, `depth`). */
171
171
  get task(): string;
172
172
  /** The active device that ran inference (`"webgpu"`, `"wasm"`, or `"cpu"`). */
173
173
  get device(): string;
package/dist/index.js CHANGED
@@ -205,6 +205,11 @@ class LiteRtBackend {
205
205
  this.model = model;
206
206
  this.device = device;
207
207
  }
208
+ /** Input shape the compiled model actually expects, when LiteRT reports it. */
209
+ get inputShape() {
210
+ const shape = this.model.getInputDetails?.()[0]?.shape;
211
+ return shape && Array.from(shape);
212
+ }
208
213
  /** Import LiteRT.js, init its wasm, and compile the model, falling back from
209
214
  * WebGPU to wasm (CPU) if the GPU accelerator cannot compile. */
210
215
  static async load(tflite, wasmUrl, accelerator) {
@@ -393,9 +398,16 @@ export class YOLO {
393
398
  console.warn("LiteRT: this is an end2end (NMS-free) model; its WebGPU delegate can't run the int64 ops, so it runs on CPU/wasm. Re-export with `end2end=False` for WebGPU.");
394
399
  }
395
400
  const backend = await LiteRtBackend.load(tflite, wasmUrl, accelerator);
401
+ // The compiled model outranks the metadata: `pipeline.inputShape` is what sizes the
402
+ // input tensor below, so a stale `imgsz` would build one the model rejects.
403
+ // Signed on purpose: the engine reports a dynamic axis as a negative number, and wasm
404
+ // rejects those rather than reading one as a huge unsigned size.
405
+ const shape = backend.inputShape;
406
+ if (shape)
407
+ pipeline.setInputShape(new Int32Array(shape));
396
408
  return new YOLO(new LiteRtEngine(pipeline, backend));
397
409
  }
398
- /** The model's task (`detect`, `segment`, `pose`, `classify`, `obb`, `semantic`). */
410
+ /** The model's task (`detect`, `segment`, `pose`, `classify`, `obb`, `semantic`, `depth`). */
399
411
  get task() {
400
412
  return this.engine.task;
401
413
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultralytics/yolo",
3
- "version": "0.0.31",
3
+ "version": "0.0.33",
4
4
  "description": "Run Ultralytics YOLO models in the browser on WebGPU (WebAssembly, ONNX Runtime Web via ort-web).",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -66,7 +66,7 @@
66
66
  }
67
67
  },
68
68
  "devDependencies": {
69
- "@litertjs/core": "^2.5.0",
69
+ "@litertjs/core": "^2.5.3",
70
70
  "typescript": "^5.4.0"
71
71
  }
72
72
  }
package/pkg/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "ultralytics-inference-web",
3
3
  "type": "module",
4
4
  "description": "Browser/WebAssembly bindings for ultralytics-inference (WebGPU via ort-web)",
5
- "version": "0.0.31",
5
+ "version": "0.0.33",
6
6
  "license": "AGPL-3.0",
7
7
  "repository": {
8
8
  "type": "git",
@@ -14,7 +14,7 @@ const FEATURES_ALL = FEATURES_WEBGL | FEATURES_WEBGPU;
14
14
  * @property {Record<'main' | 'wrapper' | 'binary', string> | null} integrities
15
15
  */
16
16
 
17
- const DEFAULT_DIST_BASE = 'https://cdn.pyke.io/0/pyke:ort-rs/web@1.24.3/';
17
+ const DEFAULT_DIST_BASE = 'https://cdn.pyke.io/0/pyke:ort-rs/web@1.27.0/';
18
18
 
19
19
  /** @type {Record<number, Dist>} */
20
20
  const DEFAULT_DIST = {
@@ -23,9 +23,9 @@ const DEFAULT_DIST = {
23
23
  scriptName: 'ort.wasm.min.js',
24
24
  binaryName: 'ort-wasm-simd-threaded.wasm',
25
25
  integrities: {
26
- main: '1SBQgvQsxJRGAOAJ6K2nPaLO1SKelZwoF+biXgv2/D9fPspYLhvG4WIMDb/BUoJC',
27
- wrapper: '/xM/eq8aUBJZgBuVwTQcLA5KlNmP6HOaENdJVgCkA/06cOMdL9EIQtmMuXOlMZEd',
28
- binary: 'sZw0EVBgUn+dNhQfjHDg8lwtmicKMm1bTvWS4rIRNxoVN1S9HkVyJ2nreMpYruEZ'
26
+ main: 'tfUvHgp9/GSRWo8HC27M+k72kO9DXscoOHJVFMMo17my+b613YTj9vpom0og1Cwe',
27
+ wrapper: 'QwBuCPwkZ1hn48SSG/YP1rd25hKczDIg103x2AtlotnwUzVF919IZz1uRnLp9IOw',
28
+ binary: 'ZBv2MGQL3EUHCYbVm9I410F+QZX7GWFj9a556jISGqlE2TiRaeEWLu6jxd8ZYMGC'
29
29
  }
30
30
  },
31
31
  [FEATURES_WEBGL]: {
@@ -33,9 +33,9 @@ const DEFAULT_DIST = {
33
33
  scriptName: 'ort.webgl.min.js',
34
34
  binaryName: 'ort-wasm-simd-threaded.wasm',
35
35
  integrities: {
36
- main: 'tBplgcsp8KUmgpc7glC4gbb5MdN/LBa1x90w++Y5WHDLaLo0m75wK+OtxIVa0KB6',
37
- wrapper: '/xM/eq8aUBJZgBuVwTQcLA5KlNmP6HOaENdJVgCkA/06cOMdL9EIQtmMuXOlMZEd',
38
- binary: 'sZw0EVBgUn+dNhQfjHDg8lwtmicKMm1bTvWS4rIRNxoVN1S9HkVyJ2nreMpYruEZ'
36
+ main: 'LXzScLvNEhm413eMpAqQVWHzPW+FRbGjfJ+u33IO6bHCV8rfBfd2eGdAwpKAdvIQ',
37
+ wrapper: 'QwBuCPwkZ1hn48SSG/YP1rd25hKczDIg103x2AtlotnwUzVF919IZz1uRnLp9IOw',
38
+ binary: 'ZBv2MGQL3EUHCYbVm9I410F+QZX7GWFj9a556jISGqlE2TiRaeEWLu6jxd8ZYMGC'
39
39
  }
40
40
  },
41
41
  [FEATURES_WEBGPU]: {
@@ -43,9 +43,9 @@ const DEFAULT_DIST = {
43
43
  scriptName: 'ort.webgpu.min.js',
44
44
  binaryName: 'ort-wasm-simd-threaded.jsep.wasm',
45
45
  integrities: {
46
- main: 'ryEl5/BLEvDIrNfBZGTpwZzs0EFe+rDt9wM/Xs5DbM7mwJm2V6/BPE7AGVtwKKiL',
47
- wrapper: 'C9DMcnZCIFFbpwJbX9QrGnrhpRt+2yD/FCcEZRrYf0iuzpOlCibPY0zsN8Wh1O+U',
48
- binary: 'SLG1FQY8ZmHhts4OFaia4WTuj6Ttjqb3U7uJQXb8L19O+HB0DG8zJh+vdmXdxD53'
46
+ main: 'vRrDQHAbl9gWevu3ErZ/gXohErGlZmJy4wyowACQUyuTXCTWAgX8fpBBg70OGWVv',
47
+ wrapper: 'UnMnZc4hekoMygc89hIyX3b7KuuNwqJTMOZJdeAQjuvGC/WVdTT+w+HmwWCANfli',
48
+ binary: 'NRkAqXy32zY6LuDA4go2FTF1Cy85jvEfSu6DPTevOmSu441+7WhVZocyqdhT1kNB'
49
49
  }
50
50
  },
51
51
  [FEATURES_ALL]: {
@@ -53,9 +53,9 @@ const DEFAULT_DIST = {
53
53
  scriptName: 'ort.all.min.js',
54
54
  binaryName: 'ort-wasm-simd-threaded.jsep.wasm',
55
55
  integrities: {
56
- main: 'aSKRQamw4Hf1ggcSUR2ZFriC21oCir1YibdErfC+xmh/w1ijdn/GP4Vr4rMu1dvs',
57
- wrapper: 'C9DMcnZCIFFbpwJbX9QrGnrhpRt+2yD/FCcEZRrYf0iuzpOlCibPY0zsN8Wh1O+U',
58
- binary: 'SLG1FQY8ZmHhts4OFaia4WTuj6Ttjqb3U7uJQXb8L19O+HB0DG8zJh+vdmXdxD53'
56
+ main: 'PbfZfzjTjLQV5yWsBfBwAOzKd0qqPbvuTgfGZfgg+7lQQM8HvS3E0M4mYM1kD4zq',
57
+ wrapper: 'UnMnZc4hekoMygc89hIyX3b7KuuNwqJTMOZJdeAQjuvGC/WVdTT+w+HmwWCANfli',
58
+ binary: 'NRkAqXy32zY6LuDA4go2FTF1Cy85jvEfSu6DPTevOmSu441+7WhVZocyqdhT1kNB'
59
59
  }
60
60
  }
61
61
  };
@@ -9,7 +9,7 @@ function track(payload) {
9
9
  }
10
10
  if (navigator.webdriver || 'Cypress' in window) {
11
11
  return false;
12
- }
12
+ }
13
13
 
14
14
  return navigator.sendBeacon(EVENT_URL, payload.buffer);
15
15
  }
@@ -35,7 +35,8 @@ function asUint32(x) {
35
35
  const encoder = new TextEncoder();
36
36
 
37
37
  let hasInitializedSession = false;
38
- export function trackSessionInit() {
38
+ /** @param {string} version */
39
+ export function trackSessionInit(version) {
39
40
  if (hasInitializedSession) {
40
41
  return true;
41
42
  }
@@ -43,10 +44,13 @@ export function trackSessionInit() {
43
44
  hasInitializedSession = true;
44
45
 
45
46
  const encodedHostname = encoder.encode(location.hostname);
47
+ const encodedVersion = encoder.encode(version);
46
48
  return track(concat(
47
49
  new Uint8Array([ 0x01 ]),
48
- new Uint8Array([ 0x90, 0x63, 0x8A, 0xE7 ]),
50
+ new Uint8Array([ 0x90, 0x61, 0x8A, 0xE7 ]),
49
51
  asUint32(encodedHostname.byteLength),
50
- encodedHostname
52
+ encodedHostname,
53
+ asUint32(encodedVersion.byteLength),
54
+ encodedVersion
51
55
  ));
52
56
  }
@@ -124,6 +124,21 @@ export class YoloPipeline {
124
124
  * Returns a JS error if the buffer size is not `width * height * 4`.
125
125
  */
126
126
  preprocess_rgba(rgba: Uint8Array, width: number, height: number): Float32Array;
127
+ /**
128
+ * Adopt the input shape the engine reports for the compiled model.
129
+ *
130
+ * Without it the size comes from the metadata, which the graph itself never has to
131
+ * agree with, and [`input_shape`](Self::input_shape) is what the caller sizes its
132
+ * input tensor from - so a stale `imgsz` would feed the model a tensor it rejects.
133
+ * The ONNX path reads the same fact off its session; this is the LiteRT equivalent,
134
+ * which only the JS engine can see.
135
+ *
136
+ * Expects NCHW `[N, 3, H, W]`, what `ai_edge_torch` emits, with the signed dimensions
137
+ * the engine reports. Any other rank or layout (a channels-last `[N, H, W, 3]`) and any
138
+ * non-positive axis, which is how a dynamic dimension is reported, is ignored and leaves
139
+ * the metadata size in place.
140
+ */
141
+ setInputShape(shape: Int32Array): void;
127
142
  /**
128
143
  * Whether this is an end-to-end (NMS-free) export, e.g. YOLO26. Its head runs
129
144
  * the NMS/top-k with `int64`/`gather_nd` ops that the LiteRT WebGPU delegate
@@ -182,12 +197,13 @@ export interface InitOutput {
182
197
  readonly yolopipeline_new: (a: number, b: number, c: number) => void;
183
198
  readonly yolopipeline_postprocess: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number) => void;
184
199
  readonly yolopipeline_preprocess_rgba: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
200
+ readonly yolopipeline_setInputShape: (a: number, b: number, c: number) => void;
185
201
  readonly yolopipeline_task: (a: number, b: number) => void;
186
202
  readonly start: () => void;
187
- readonly __wasm_bindgen_func_elem_1941: (a: number, b: number, c: number, d: number) => void;
188
- readonly __wasm_bindgen_func_elem_2540: (a: number, b: number, c: number, d: number) => void;
189
- readonly __wasm_bindgen_func_elem_1941_2: (a: number, b: number, c: number, d: number) => void;
190
- readonly __wasm_bindgen_func_elem_2564: (a: number, b: number, c: number, d: number) => void;
203
+ readonly __wasm_bindgen_func_elem_1956: (a: number, b: number, c: number, d: number) => void;
204
+ readonly __wasm_bindgen_func_elem_2558: (a: number, b: number, c: number, d: number) => void;
205
+ readonly __wasm_bindgen_func_elem_1956_2: (a: number, b: number, c: number, d: number) => void;
206
+ readonly __wasm_bindgen_func_elem_2582: (a: number, b: number, c: number, d: number) => void;
191
207
  readonly __wbindgen_export: (a: number, b: number) => number;
192
208
  readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
193
209
  readonly __wbindgen_export3: (a: number) => void;
@@ -1,6 +1,6 @@
1
1
  /* @ts-self-types="./ultralytics_inference_web.d.ts" */
2
- import { initRuntime } from './snippets/ort-web-c7b42e3e9fb58316/_loader.js';
3
- import { trackSessionInit } from './snippets/ort-web-c7b42e3e9fb58316/_telemetry.js';
2
+ import { initRuntime } from './snippets/ort-web-74be4d1a4544c8bc/_loader.js';
3
+ import { trackSessionInit } from './snippets/ort-web-74be4d1a4544c8bc/_telemetry.js';
4
4
 
5
5
 
6
6
  /**
@@ -369,6 +369,26 @@ export class YoloPipeline {
369
369
  wasm.__wbindgen_add_to_stack_pointer(16);
370
370
  }
371
371
  }
372
+ /**
373
+ * Adopt the input shape the engine reports for the compiled model.
374
+ *
375
+ * Without it the size comes from the metadata, which the graph itself never has to
376
+ * agree with, and [`input_shape`](Self::input_shape) is what the caller sizes its
377
+ * input tensor from - so a stale `imgsz` would feed the model a tensor it rejects.
378
+ * The ONNX path reads the same fact off its session; this is the LiteRT equivalent,
379
+ * which only the JS engine can see.
380
+ *
381
+ * Expects NCHW `[N, 3, H, W]`, what `ai_edge_torch` emits, with the signed dimensions
382
+ * the engine reports. Any other rank or layout (a channels-last `[N, H, W, 3]`) and any
383
+ * non-positive axis, which is how a dynamic dimension is reported, is ignored and leaves
384
+ * the metadata size in place.
385
+ * @param {Int32Array} shape
386
+ */
387
+ setInputShape(shape) {
388
+ const ptr0 = passArray32ToWasm0(shape, wasm.__wbindgen_export);
389
+ const len0 = WASM_VECTOR_LEN;
390
+ wasm.yolopipeline_setInputShape(this.__wbg_ptr, ptr0, len0);
391
+ }
372
392
  /**
373
393
  * The model's task (`"detect"`, `"segment"`, ...).
374
394
  * @returns {string}
@@ -527,19 +547,19 @@ function __wbg_get_imports() {
527
547
  const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
528
548
  return addHeapObject(ret);
529
549
  }, arguments); },
530
- __wbg_create_604d3dd8b0220101: function() { return handleError(function (arg0, arg1, arg2) {
550
+ __wbg_create_8f5a33c6bfe341e8: function() { return handleError(function (arg0, arg1, arg2) {
531
551
  const ret = ort.InferenceSession.create(getStringFromWasm0(arg0, arg1), takeObject(arg2));
532
552
  return addHeapObject(ret);
533
553
  }, arguments); },
534
- __wbg_create_aa26088c323fe759: function() { return handleError(function (arg0, arg1) {
554
+ __wbg_create_ab62f00735deac66: function() { return handleError(function (arg0, arg1) {
535
555
  const ret = ort.InferenceSession.create(getObject(arg0), takeObject(arg1));
536
556
  return addHeapObject(ret);
537
557
  }, arguments); },
538
- __wbg_data_f77ae23e62caa57c: function() { return handleError(function (arg0) {
558
+ __wbg_data_926466624da78512: function() { return handleError(function (arg0) {
539
559
  const ret = getObject(arg0).data;
540
560
  return addHeapObject(ret);
541
561
  }, arguments); },
542
- __wbg_dims_4cbc39371d1db46c: function(arg0, arg1) {
562
+ __wbg_dims_9f13b995a90df835: function(arg0, arg1) {
543
563
  const ret = getObject(arg1).dims;
544
564
  const ptr1 = passArray32ToWasm0(ret, wasm.__wbindgen_export);
545
565
  const len1 = WASM_VECTOR_LEN;
@@ -569,7 +589,7 @@ function __wbg_get_imports() {
569
589
  const ret = Array.from(getObject(arg0));
570
590
  return addHeapObject(ret);
571
591
  },
572
- __wbg_getData_87474928ad362e4c: function() { return handleError(function (arg0) {
592
+ __wbg_getData_1b8044301ffc7d79: function() { return handleError(function (arg0) {
573
593
  const ret = getObject(arg0).getData();
574
594
  return addHeapObject(ret);
575
595
  }, arguments); },
@@ -593,18 +613,18 @@ function __wbg_get_imports() {
593
613
  const ret = getObject(arg0)[getObject(arg1)];
594
614
  return addHeapObject(ret);
595
615
  },
596
- __wbg_initRuntime_8e839bc51a59b99d: function() { return handleError(function (arg0, arg1) {
616
+ __wbg_initRuntime_461bceccb341c20d: function() { return handleError(function (arg0, arg1) {
597
617
  const ret = initRuntime(arg0, takeObject(arg1));
598
618
  return addHeapObject(ret);
599
619
  }, arguments); },
600
- __wbg_inputMetadata_87b8670ec1aecff3: function(arg0, arg1) {
620
+ __wbg_inputMetadata_5ab975ce7a9db793: function(arg0, arg1) {
601
621
  const ret = getObject(arg1).inputMetadata;
602
622
  const ptr1 = passArrayJsValueToWasm0(ret, wasm.__wbindgen_export);
603
623
  const len1 = WASM_VECTOR_LEN;
604
624
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
605
625
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
606
626
  },
607
- __wbg_inputNames_006e79de2e9d06b0: function(arg0, arg1) {
627
+ __wbg_inputNames_379bb0f6b0bbddb0: function(arg0, arg1) {
608
628
  const ret = getObject(arg1).inputNames;
609
629
  const ptr1 = passArrayJsValueToWasm0(ret, wasm.__wbindgen_export);
610
630
  const len1 = WASM_VECTOR_LEN;
@@ -675,7 +695,7 @@ function __wbg_get_imports() {
675
695
  const ret = getObject(arg0).length;
676
696
  return ret;
677
697
  },
678
- __wbg_location_40d7e9906760d235: function(arg0) {
698
+ __wbg_location_b0c2e70b6a815475: function(arg0) {
679
699
  const ret = getObject(arg0).location;
680
700
  return (__wbindgen_enum_DataLocation.indexOf(ret) + 1 || 7) - 1;
681
701
  },
@@ -699,7 +719,7 @@ function __wbg_get_imports() {
699
719
  const ret = new Object();
700
720
  return addHeapObject(ret);
701
721
  },
702
- __wbg_new_from_buffer_raw_4a1de2fd5040de11: function() { return handleError(function (arg0, arg1, arg2) {
722
+ __wbg_new_from_buffer_raw_913772a28563e085: function() { return handleError(function (arg0, arg1, arg2) {
703
723
  const ret = new ort.Tensor(__wbindgen_enum_DataType[arg0], takeObject(arg1), takeObject(arg2));
704
724
  return addHeapObject(ret);
705
725
  }, arguments); },
@@ -714,7 +734,7 @@ function __wbg_get_imports() {
714
734
  const a = state0.a;
715
735
  state0.a = 0;
716
736
  try {
717
- return __wasm_bindgen_func_elem_2564(a, state0.b, arg0, arg1);
737
+ return __wasm_bindgen_func_elem_2582(a, state0.b, arg0, arg1);
718
738
  } finally {
719
739
  state0.a = a;
720
740
  }
@@ -781,14 +801,14 @@ function __wbg_get_imports() {
781
801
  const ret = getObject(arg0).now();
782
802
  return ret;
783
803
  },
784
- __wbg_outputMetadata_f60f543c30563643: function(arg0, arg1) {
804
+ __wbg_outputMetadata_7800f416aa5ef49d: function(arg0, arg1) {
785
805
  const ret = getObject(arg1).outputMetadata;
786
806
  const ptr1 = passArrayJsValueToWasm0(ret, wasm.__wbindgen_export);
787
807
  const len1 = WASM_VECTOR_LEN;
788
808
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
789
809
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
790
810
  },
791
- __wbg_outputNames_5e88e61bf53e5de8: function(arg0, arg1) {
811
+ __wbg_outputNames_e4fd207c684625a6: function(arg0, arg1) {
792
812
  const ret = getObject(arg1).outputNames;
793
813
  const ptr1 = passArrayJsValueToWasm0(ret, wasm.__wbindgen_export);
794
814
  const len1 = WASM_VECTOR_LEN;
@@ -824,7 +844,7 @@ function __wbg_get_imports() {
824
844
  const ret = Promise.resolve(getObject(arg0));
825
845
  return addHeapObject(ret);
826
846
  },
827
- __wbg_run_91f1b7e43bde55af: function() { return handleError(function (arg0, arg1) {
847
+ __wbg_run_00a506dcbf8e4bb0: function() { return handleError(function (arg0, arg1) {
828
848
  const ret = getObject(arg0).run(takeObject(arg1));
829
849
  return addHeapObject(ret);
830
850
  }, arguments); },
@@ -887,11 +907,11 @@ function __wbg_get_imports() {
887
907
  const ret = getObject(arg0).toString();
888
908
  return addHeapObject(ret);
889
909
  },
890
- __wbg_trackSessionInit_d2f5559748b8ff80: function() { return handleError(function () {
891
- const ret = trackSessionInit();
910
+ __wbg_trackSessionInit_a492d3a59889a1ae: function() { return handleError(function (arg0, arg1) {
911
+ const ret = trackSessionInit(getStringFromWasm0(arg0, arg1));
892
912
  return addHeapObject(ret);
893
913
  }, arguments); },
894
- __wbg_type_5bf9facd6ac793eb: function(arg0) {
914
+ __wbg_type_36ea46c1a40b10d2: function(arg0) {
895
915
  const ret = getObject(arg0).type;
896
916
  return (__wbindgen_enum_DataType.indexOf(ret) + 1 || 16) - 1;
897
917
  },
@@ -904,18 +924,18 @@ function __wbg_get_imports() {
904
924
  return addHeapObject(ret);
905
925
  },
906
926
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
907
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 690, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
908
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_1941);
927
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 689, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
928
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_1956);
909
929
  return addHeapObject(ret);
910
930
  },
911
931
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
912
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 910, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
913
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_2540);
932
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 914, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
933
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_2558);
914
934
  return addHeapObject(ret);
915
935
  },
916
936
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
917
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("boolean")], shim_idx: 690, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
918
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_1941_2);
937
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("boolean")], shim_idx: 689, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
938
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_1956_2);
919
939
  return addHeapObject(ret);
920
940
  },
921
941
  __wbindgen_cast_0000000000000004: function(arg0) {
@@ -1002,10 +1022,10 @@ function __wbg_get_imports() {
1002
1022
  };
1003
1023
  }
1004
1024
 
1005
- function __wasm_bindgen_func_elem_1941(arg0, arg1, arg2) {
1025
+ function __wasm_bindgen_func_elem_1956(arg0, arg1, arg2) {
1006
1026
  try {
1007
1027
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1008
- wasm.__wasm_bindgen_func_elem_1941(retptr, arg0, arg1, addHeapObject(arg2));
1028
+ wasm.__wasm_bindgen_func_elem_1956(retptr, arg0, arg1, addHeapObject(arg2));
1009
1029
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1010
1030
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1011
1031
  if (r1) {
@@ -1016,10 +1036,10 @@ function __wasm_bindgen_func_elem_1941(arg0, arg1, arg2) {
1016
1036
  }
1017
1037
  }
1018
1038
 
1019
- function __wasm_bindgen_func_elem_2540(arg0, arg1, arg2) {
1039
+ function __wasm_bindgen_func_elem_2558(arg0, arg1, arg2) {
1020
1040
  try {
1021
1041
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1022
- wasm.__wasm_bindgen_func_elem_2540(retptr, arg0, arg1, addHeapObject(arg2));
1042
+ wasm.__wasm_bindgen_func_elem_2558(retptr, arg0, arg1, addHeapObject(arg2));
1023
1043
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1024
1044
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1025
1045
  if (r1) {
@@ -1030,10 +1050,10 @@ function __wasm_bindgen_func_elem_2540(arg0, arg1, arg2) {
1030
1050
  }
1031
1051
  }
1032
1052
 
1033
- function __wasm_bindgen_func_elem_1941_2(arg0, arg1, arg2) {
1053
+ function __wasm_bindgen_func_elem_1956_2(arg0, arg1, arg2) {
1034
1054
  try {
1035
1055
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1036
- wasm.__wasm_bindgen_func_elem_1941_2(retptr, arg0, arg1, addHeapObject(arg2));
1056
+ wasm.__wasm_bindgen_func_elem_1956_2(retptr, arg0, arg1, addHeapObject(arg2));
1037
1057
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1038
1058
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1039
1059
  if (r1) {
@@ -1044,8 +1064,8 @@ function __wasm_bindgen_func_elem_1941_2(arg0, arg1, arg2) {
1044
1064
  }
1045
1065
  }
1046
1066
 
1047
- function __wasm_bindgen_func_elem_2564(arg0, arg1, arg2, arg3) {
1048
- wasm.__wasm_bindgen_func_elem_2564(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
1067
+ function __wasm_bindgen_func_elem_2582(arg0, arg1, arg2, arg3) {
1068
+ wasm.__wasm_bindgen_func_elem_2582(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
1049
1069
  }
1050
1070
 
1051
1071
 
@@ -16,12 +16,13 @@ export const yolopipeline_names: (a: number, b: number) => void;
16
16
  export const yolopipeline_new: (a: number, b: number, c: number) => void;
17
17
  export const yolopipeline_postprocess: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number) => void;
18
18
  export const yolopipeline_preprocess_rgba: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
19
+ export const yolopipeline_setInputShape: (a: number, b: number, c: number) => void;
19
20
  export const yolopipeline_task: (a: number, b: number) => void;
20
21
  export const start: () => void;
21
- export const __wasm_bindgen_func_elem_1941: (a: number, b: number, c: number, d: number) => void;
22
- export const __wasm_bindgen_func_elem_2540: (a: number, b: number, c: number, d: number) => void;
23
- export const __wasm_bindgen_func_elem_1941_2: (a: number, b: number, c: number, d: number) => void;
24
- export const __wasm_bindgen_func_elem_2564: (a: number, b: number, c: number, d: number) => void;
22
+ export const __wasm_bindgen_func_elem_1956: (a: number, b: number, c: number, d: number) => void;
23
+ export const __wasm_bindgen_func_elem_2558: (a: number, b: number, c: number, d: number) => void;
24
+ export const __wasm_bindgen_func_elem_1956_2: (a: number, b: number, c: number, d: number) => void;
25
+ export const __wasm_bindgen_func_elem_2582: (a: number, b: number, c: number, d: number) => void;
25
26
  export const __wbindgen_export: (a: number, b: number) => number;
26
27
  export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
27
28
  export const __wbindgen_export3: (a: number) => void;