@ultralytics/yolo 0.0.32 → 0.0.34

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,6 +30,8 @@
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
37
  fallback) and covers detection, segmentation, pose, classification, OBB,
@@ -281,7 +299,7 @@ Notes:
281
299
  If you load an end2end `.tflite` anyway, the backend auto-switches it to wasm
282
300
  (slower) and logs a warning rather than returning empty results.
283
301
 
284
- - **Tasks**: detect, segment, pose, obb, classify, and semantic are all supported.
302
+ - **Tasks**: detect, segment, pose, obb, classify, semantic, and depth are all supported.
285
303
  - **Cross-origin isolation**: LiteRT's threaded wasm wants `SharedArrayBuffer`,
286
304
  so serve with `Cross-Origin-Opener-Policy: same-origin` and
287
305
  `Cross-Origin-Embedder-Policy: require-corp`.
@@ -298,7 +316,7 @@ npm run build # wasm-pack build + tsc
298
316
  Serve the built package over `localhost` (a secure context) with the two
299
317
  cross-origin isolation headers above, then open it in a WebGPU browser.
300
318
 
301
- ## 💡 Contributing
319
+ ## 💡 Contribute
302
320
 
303
321
  Ultralytics thrives on community collaboration, and we deeply value your contributions! Whether it's reporting bugs,
304
322
  suggesting features, or submitting code changes, your involvement is crucial.
@@ -312,7 +330,7 @@ A heartfelt thank you 🙏 goes out to all our contributors! Your efforts help m
312
330
 
313
331
  [![Ultralytics open-source contributors](https://raw.githubusercontent.com/ultralytics/assets/main/im/image-contributors.png)](https://github.com/ultralytics/ultralytics/graphs/contributors)
314
332
 
315
- ## 📜 License
333
+ ## 📄 License
316
334
 
317
335
  Ultralytics offers two licensing options to suit different needs:
318
336
 
@@ -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 和 depth 均已支持。
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultralytics/yolo",
3
- "version": "0.0.32",
3
+ "version": "0.0.34",
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",
@@ -67,6 +67,6 @@
67
67
  },
68
68
  "devDependencies": {
69
69
  "@litertjs/core": "^2.5.3",
70
- "typescript": "^5.4.0"
70
+ "typescript": "^7.0.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.32",
5
+ "version": "0.0.34",
6
6
  "license": "AGPL-3.0",
7
7
  "repository": {
8
8
  "type": "git",
@@ -200,10 +200,10 @@ export interface InitOutput {
200
200
  readonly yolopipeline_setInputShape: (a: number, b: number, c: number) => void;
201
201
  readonly yolopipeline_task: (a: number, b: number) => void;
202
202
  readonly start: () => 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;
203
+ readonly __wasm_bindgen_func_elem_1953: (a: number, b: number, c: number, d: number) => void;
204
+ readonly __wasm_bindgen_func_elem_2557: (a: number, b: number, c: number, d: number) => void;
205
+ readonly __wasm_bindgen_func_elem_1953_2: (a: number, b: number, c: number, d: number) => void;
206
+ readonly __wasm_bindgen_func_elem_2581: (a: number, b: number, c: number, d: number) => void;
207
207
  readonly __wbindgen_export: (a: number, b: number) => number;
208
208
  readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
209
209
  readonly __wbindgen_export3: (a: number) => void;
@@ -734,7 +734,7 @@ function __wbg_get_imports() {
734
734
  const a = state0.a;
735
735
  state0.a = 0;
736
736
  try {
737
- return __wasm_bindgen_func_elem_2582(a, state0.b, arg0, arg1);
737
+ return __wasm_bindgen_func_elem_2581(a, state0.b, arg0, arg1);
738
738
  } finally {
739
739
  state0.a = a;
740
740
  }
@@ -925,17 +925,17 @@ function __wbg_get_imports() {
925
925
  },
926
926
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
927
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);
928
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_1953);
929
929
  return addHeapObject(ret);
930
930
  },
931
931
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
932
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);
933
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_2557);
934
934
  return addHeapObject(ret);
935
935
  },
936
936
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
937
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);
938
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_1953_2);
939
939
  return addHeapObject(ret);
940
940
  },
941
941
  __wbindgen_cast_0000000000000004: function(arg0) {
@@ -1022,10 +1022,10 @@ function __wbg_get_imports() {
1022
1022
  };
1023
1023
  }
1024
1024
 
1025
- function __wasm_bindgen_func_elem_1956(arg0, arg1, arg2) {
1025
+ function __wasm_bindgen_func_elem_1953(arg0, arg1, arg2) {
1026
1026
  try {
1027
1027
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1028
- wasm.__wasm_bindgen_func_elem_1956(retptr, arg0, arg1, addHeapObject(arg2));
1028
+ wasm.__wasm_bindgen_func_elem_1953(retptr, arg0, arg1, addHeapObject(arg2));
1029
1029
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1030
1030
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1031
1031
  if (r1) {
@@ -1036,10 +1036,10 @@ function __wasm_bindgen_func_elem_1956(arg0, arg1, arg2) {
1036
1036
  }
1037
1037
  }
1038
1038
 
1039
- function __wasm_bindgen_func_elem_2558(arg0, arg1, arg2) {
1039
+ function __wasm_bindgen_func_elem_2557(arg0, arg1, arg2) {
1040
1040
  try {
1041
1041
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1042
- wasm.__wasm_bindgen_func_elem_2558(retptr, arg0, arg1, addHeapObject(arg2));
1042
+ wasm.__wasm_bindgen_func_elem_2557(retptr, arg0, arg1, addHeapObject(arg2));
1043
1043
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1044
1044
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1045
1045
  if (r1) {
@@ -1050,10 +1050,10 @@ function __wasm_bindgen_func_elem_2558(arg0, arg1, arg2) {
1050
1050
  }
1051
1051
  }
1052
1052
 
1053
- function __wasm_bindgen_func_elem_1956_2(arg0, arg1, arg2) {
1053
+ function __wasm_bindgen_func_elem_1953_2(arg0, arg1, arg2) {
1054
1054
  try {
1055
1055
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1056
- wasm.__wasm_bindgen_func_elem_1956_2(retptr, arg0, arg1, addHeapObject(arg2));
1056
+ wasm.__wasm_bindgen_func_elem_1953_2(retptr, arg0, arg1, addHeapObject(arg2));
1057
1057
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1058
1058
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1059
1059
  if (r1) {
@@ -1064,8 +1064,8 @@ function __wasm_bindgen_func_elem_1956_2(arg0, arg1, arg2) {
1064
1064
  }
1065
1065
  }
1066
1066
 
1067
- function __wasm_bindgen_func_elem_2582(arg0, arg1, arg2, arg3) {
1068
- wasm.__wasm_bindgen_func_elem_2582(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
1067
+ function __wasm_bindgen_func_elem_2581(arg0, arg1, arg2, arg3) {
1068
+ wasm.__wasm_bindgen_func_elem_2581(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
1069
1069
  }
1070
1070
 
1071
1071
 
@@ -19,10 +19,10 @@ export const yolopipeline_preprocess_rgba: (a: number, b: number, c: number, d:
19
19
  export const yolopipeline_setInputShape: (a: number, b: number, c: number) => void;
20
20
  export const yolopipeline_task: (a: number, b: number) => void;
21
21
  export const start: () => 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;
22
+ export const __wasm_bindgen_func_elem_1953: (a: number, b: number, c: number, d: number) => void;
23
+ export const __wasm_bindgen_func_elem_2557: (a: number, b: number, c: number, d: number) => void;
24
+ export const __wasm_bindgen_func_elem_1953_2: (a: number, b: number, c: number, d: number) => void;
25
+ export const __wasm_bindgen_func_elem_2581: (a: number, b: number, c: number, d: number) => void;
26
26
  export const __wbindgen_export: (a: number, b: number) => number;
27
27
  export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
28
28
  export const __wbindgen_export3: (a: number) => void;