@ultralytics/yolo 0.0.54 → 0.0.55
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 +9 -17
- package/README.zh-CN.md +8 -15
- package/dist/index.d.ts +3 -2
- package/dist/index.js +69 -86
- package/package.json +1 -1
- package/pkg/package.json +1 -1
- package/pkg/ultralytics_inference_web.d.ts +6 -10
- package/pkg/ultralytics_inference_web.js +84 -78
- package/pkg/ultralytics_inference_web_bg.wasm +0 -0
- package/pkg/ultralytics_inference_web_bg.wasm.d.ts +4 -4
- /package/pkg/snippets/{ort-web-d1ef36df9bbdf0c7 → ort-web-d8e9a032d14319ec}/_loader.js +0 -0
- /package/pkg/snippets/{ort-web-d1ef36df9bbdf0c7 → ort-web-d8e9a032d14319ec}/_telemetry.js +0 -0
package/README.md
CHANGED
|
@@ -193,14 +193,12 @@ await annotate(canvas, img, results, { keypointRadius: 4, skeleton: [[0, 1]] });
|
|
|
193
193
|
`YOLO.load("/models/yolo26n.onnx", { device: "webgpu" | "cpu" })` (default `"auto"`). If
|
|
194
194
|
WebGPU cannot engage, the load falls back to CPU; `model.device` reports what
|
|
195
195
|
actually ran.
|
|
196
|
+
- **Workers**: LiteRT image inputs and timing support worker globals; LiteRT's own worker asset
|
|
197
|
+
loading requirements still apply. The ONNX Runtime Web loader requires a browser window.
|
|
196
198
|
- **RT-DETR**: supported for detection. An RT-DETR `.onnx` runs on WebGPU like any other
|
|
197
|
-
model.
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
explicit `device: "webgpu"` is still attempted rather than overridden, so the delegate can
|
|
201
|
-
be re-tested as it gains ops; on current drivers that attempt fails and LiteRT falls back
|
|
202
|
-
to CPU/wasm, and `model.device` reports what ran. Export one yourself, since no RT-DETR
|
|
203
|
-
ONNX or LiteRT model is published.
|
|
199
|
+
model. LiteRT models that cannot be fully delegated to WebGPU run on CPU/wasm;
|
|
200
|
+
`model.device` reports the selected device. Export an RT-DETR model yourself, since
|
|
201
|
+
no ONNX or LiteRT model is published.
|
|
204
202
|
- **Model format**: export your model to ONNX with Ultralytics `>=8.4.142` so the metadata
|
|
205
203
|
(task, class names, `imgsz`) is embedded:
|
|
206
204
|
|
|
@@ -302,19 +300,14 @@ Notes:
|
|
|
302
300
|
embedded metadata) ships in
|
|
303
301
|
[v8.4.83](https://github.com/ultralytics/ultralytics/releases/tag/v8.4.83) and
|
|
304
302
|
later. Earlier versions emit the legacy TFLite format and won't load here.
|
|
305
|
-
- **
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
the one-to-many head by default, so NMS runs in this package's Rust and inference stays
|
|
309
|
-
on WebGPU:
|
|
303
|
+
- **NMS-free models**: recent YOLO26 LiteRT exports use GPU-compatible operators. Older
|
|
304
|
+
exports contain operations that may prevent full WebGPU delegation; those run on CPU/wasm.
|
|
305
|
+
Alternatively, export the one-to-many head to run NMS in Rust:
|
|
310
306
|
|
|
311
307
|
```bash
|
|
312
308
|
yolo export model=yolo26n.pt format=litert nms=None
|
|
313
309
|
```
|
|
314
310
|
|
|
315
|
-
If you load an NMS-free `.tflite`, the backend auto-switches it to wasm
|
|
316
|
-
(slower) and logs a warning rather than returning empty results.
|
|
317
|
-
|
|
318
311
|
- **Tasks**: detect, segment, semantic, depth, classify, pose, and obb are all supported.
|
|
319
312
|
- **Cross-origin isolation**: LiteRT's threaded wasm wants `SharedArrayBuffer`,
|
|
320
313
|
so serve with `Cross-Origin-Opener-Policy: same-origin` and
|
|
@@ -336,8 +329,7 @@ ONNX Runtime Web (`.onnx`):
|
|
|
336
329
|
|
|
337
330
|
Apple M4, Chrome 153, `@ultralytics/yolo` 0.0.48 (ONNX Runtime Web 1.27, LiteRT.js 2.5.3). FP32 640×640 models
|
|
338
331
|
exported with Ultralytics 8.4.163 (`nms=None`), cycling through the 128 COCO128 images after warmup (128 timed runs on
|
|
339
|
-
WebGPU, 50 on CPU). NMS-free exports (`nms=False`)
|
|
340
|
-
to CPU/wasm for them, so keep `nms=None` for WebGPU.
|
|
332
|
+
WebGPU, 50 on CPU). Recent NMS-free LiteRT exports (`nms=False`) can also run on WebGPU.
|
|
341
333
|
|
|
342
334
|
## 🔨 Building From Source
|
|
343
335
|
|
package/README.zh-CN.md
CHANGED
|
@@ -184,13 +184,11 @@ await annotate(canvas, img, results, { keypointRadius: 4, skeleton: [[0, 1]] });
|
|
|
184
184
|
`YOLO.load` 会自动回退到通用的 **CPU/wasm** 构建,随处可用。可通过
|
|
185
185
|
`YOLO.load("/models/yolo26n.onnx", { device: "webgpu" | "cpu" })` 指定设备(默认 `"auto"`)。若 WebGPU
|
|
186
186
|
无法启用,加载会回退到 CPU;`model.device` 会报告实际使用的设备。
|
|
187
|
-
- **
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
尝试会失败,LiteRT 会回退到 CPU/wasm,`model.device` 会报告实际使用的设备。官方没有发布
|
|
193
|
-
RT-DETR 的 ONNX 或 LiteRT 模型,需要自行导出。
|
|
187
|
+
- **Worker**:LiteRT 图像输入和计时支持 worker 环境,但仍须满足 LiteRT 自身的 worker 资源加载要求。
|
|
188
|
+
ONNX Runtime Web 加载器需要浏览器窗口。
|
|
189
|
+
- **RT-DETR**:支持检测任务。RT-DETR 的 `.onnx` 可以像其他模型一样在 WebGPU 上运行。
|
|
190
|
+
无法完全委托给 WebGPU 的 LiteRT 模型会在 CPU/wasm 上运行,`model.device` 会报告实际使用的设备。
|
|
191
|
+
官方没有发布 RT-DETR 的 ONNX 或 LiteRT 模型,需要自行导出。
|
|
194
192
|
- **模型格式**:请使用 Ultralytics `>=8.4.142` 导出为 ONNX,以便元数据(任务、类别名称、`imgsz`)被嵌入模型:
|
|
195
193
|
|
|
196
194
|
```python
|
|
@@ -280,17 +278,13 @@ wasm 默认从 jsDelivr CDN 加载;向 `YOLO.load` 传入 `litertWasmUrl: "/li
|
|
|
280
278
|
- **现有模型兼容性**:带内嵌元数据的单文件 LiteRT 导出自
|
|
281
279
|
[v8.4.83](https://github.com/ultralytics/ultralytics/releases/tag/v8.4.83) 起提供。更早的版本
|
|
282
280
|
会导出旧版 TFLite 格式,无法在这里加载。
|
|
283
|
-
-
|
|
284
|
-
|
|
285
|
-
回退到 CPU/wasm。以下命令需要 Ultralytics `>=8.4.142`,默认导出一对多检测头,NMS 由本包的 Rust 代码执行,
|
|
286
|
-
推理得以保持在 WebGPU 上:
|
|
281
|
+
- **无 NMS 模型**:较新的 YOLO26 LiteRT 导出使用兼容 GPU 的算子。旧版导出可能包含无法完全委托给
|
|
282
|
+
WebGPU 的算子,此时模型会在 CPU/wasm 上运行。也可以导出一对多检测头,由 Rust 执行 NMS:
|
|
287
283
|
|
|
288
284
|
```bash
|
|
289
285
|
yolo export model=yolo26n.pt format=litert nms=None
|
|
290
286
|
```
|
|
291
287
|
|
|
292
|
-
如果加载了无 NMS 的 `.tflite`,后端会自动切换到 wasm(较慢)并打印警告,而不是返回空结果。
|
|
293
|
-
|
|
294
288
|
- **支持的任务**:detect、segment、semantic、depth、classify、pose 和 obb 均已支持。
|
|
295
289
|
- **跨源隔离**:LiteRT 的多线程 wasm 需要 `SharedArrayBuffer`,因此请以
|
|
296
290
|
`Cross-Origin-Opener-Policy: same-origin` 和 `Cross-Origin-Embedder-Policy: require-corp`
|
|
@@ -312,8 +306,7 @@ Web(`.onnx`):
|
|
|
312
306
|
|
|
313
307
|
测试环境:Apple M4、Chrome 153、`@ultralytics/yolo` 0.0.48(ONNX Runtime Web 1.27、LiteRT.js 2.5.3)。模型为使用
|
|
314
308
|
Ultralytics 8.4.163 导出的 FP32 640×640 模型(`nms=None`),预热后循环使用 COCO128 的 128 张图像(WebGPU 计时 128 次,CPU
|
|
315
|
-
计时 50
|
|
316
|
-
请保持 `nms=None`。
|
|
309
|
+
计时 50 次)。较新的无 NMS LiteRT 导出(`nms=False`)也可以在 WebGPU 上运行。
|
|
317
310
|
|
|
318
311
|
## 🔨 从源码构建
|
|
319
312
|
|
package/dist/index.d.ts
CHANGED
|
@@ -161,13 +161,14 @@ export interface AnnotateOptions {
|
|
|
161
161
|
depthAlpha?: number;
|
|
162
162
|
}
|
|
163
163
|
/** Image-like inputs accepted by {@link YOLO.predict}. */
|
|
164
|
-
export type ImageInput = string | URL | Blob | ArrayBuffer | Uint8Array | ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap;
|
|
164
|
+
export type ImageInput = string | URL | Blob | ArrayBuffer | Uint8Array | ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | OffscreenCanvas | ImageBitmap;
|
|
165
165
|
/**
|
|
166
166
|
* A loaded YOLO model. Loading is asynchronous, so use {@link YOLO.load} instead
|
|
167
167
|
* of a constructor.
|
|
168
168
|
*/
|
|
169
169
|
export declare class YOLO {
|
|
170
170
|
private readonly engine;
|
|
171
|
+
private queue;
|
|
171
172
|
private constructor();
|
|
172
173
|
/**
|
|
173
174
|
* Load a model and initialize the inference backend.
|
|
@@ -193,7 +194,7 @@ export declare class YOLO {
|
|
|
193
194
|
* Run inference on an image.
|
|
194
195
|
*
|
|
195
196
|
* Drawable sources (`ImageData`, `HTMLImageElement`, `HTMLCanvasElement`,
|
|
196
|
-
* `HTMLVideoElement`, `ImageBitmap`) take a fast path that reads raw pixels
|
|
197
|
+
* `HTMLVideoElement`, `OffscreenCanvas`, `ImageBitmap`) take a fast path that reads raw pixels
|
|
197
198
|
* with no re-encoding, ideal for webcam/video. URLs, `Blob`s, and raw bytes
|
|
198
199
|
* are decoded (in wasm for `ort`, via a canvas for `litert`).
|
|
199
200
|
*
|
package/dist/index.js
CHANGED
|
@@ -73,33 +73,24 @@ function decodeResults(raw) {
|
|
|
73
73
|
r.semantic_mask = sem && sem.length ? new Uint16Array(sem.buffer, sem.byteOffset, sem.length / 2) : undefined;
|
|
74
74
|
return r;
|
|
75
75
|
}
|
|
76
|
-
let initialized
|
|
77
|
-
/**
|
|
78
|
-
* `ort-web` 0.4.0 reads tensor dims as 64-bit integers, but ONNX Runtime Web returns plain
|
|
79
|
-
* numbers, which the wasm glue then rejects with "Cannot convert 1 to a BigInt". Accept number
|
|
80
|
-
* arrays in `BigUint64Array.set`, which only ever threw for them before.
|
|
81
|
-
*/
|
|
82
|
-
function allowNumberDims() {
|
|
83
|
-
const set = BigUint64Array.prototype.set;
|
|
84
|
-
BigUint64Array.prototype.set = function (src, offset) {
|
|
85
|
-
set.call(this, Array.isArray(src) ? src.map((v) => BigInt(v)) : src, offset);
|
|
86
|
-
};
|
|
87
|
-
}
|
|
76
|
+
let initialized;
|
|
88
77
|
/** Initialize the wasm module exactly once. */
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
78
|
+
function ensureInit(wasmUrl) {
|
|
79
|
+
initialized ?? (initialized = init(wasmUrl ? { module_or_path: wasmUrl } : undefined)
|
|
80
|
+
.then(() => start())
|
|
81
|
+
.catch((error) => {
|
|
82
|
+
initialized = undefined;
|
|
83
|
+
throw error;
|
|
84
|
+
}));
|
|
85
|
+
return initialized;
|
|
96
86
|
}
|
|
97
87
|
function isDrawable(input) {
|
|
98
|
-
return (input instanceof ImageData ||
|
|
99
|
-
input instanceof HTMLImageElement ||
|
|
100
|
-
input instanceof HTMLCanvasElement ||
|
|
101
|
-
input instanceof HTMLVideoElement ||
|
|
102
|
-
input instanceof
|
|
88
|
+
return ((typeof ImageData !== "undefined" && input instanceof ImageData) ||
|
|
89
|
+
(typeof HTMLImageElement !== "undefined" && input instanceof HTMLImageElement) ||
|
|
90
|
+
(typeof HTMLCanvasElement !== "undefined" && input instanceof HTMLCanvasElement) ||
|
|
91
|
+
(typeof HTMLVideoElement !== "undefined" && input instanceof HTMLVideoElement) ||
|
|
92
|
+
(typeof OffscreenCanvas !== "undefined" && input instanceof OffscreenCanvas) ||
|
|
93
|
+
(typeof ImageBitmap !== "undefined" && input instanceof ImageBitmap));
|
|
103
94
|
}
|
|
104
95
|
/** Fetch a URL and throw a clear error naming `what` if the response is not OK. */
|
|
105
96
|
async function fetchOk(url, what) {
|
|
@@ -121,15 +112,20 @@ async function toBytes(input, what) {
|
|
|
121
112
|
}
|
|
122
113
|
/** Read a drawable source as raw RGBA pixels (the fast path, no re-encoding). */
|
|
123
114
|
function toImageData(input) {
|
|
124
|
-
if (input instanceof ImageData) {
|
|
125
|
-
return {
|
|
115
|
+
if (typeof ImageData !== "undefined" && input instanceof ImageData) {
|
|
116
|
+
return {
|
|
117
|
+
// Snapshot caller-owned pixels before a queued prediction can yield.
|
|
118
|
+
data: new Uint8Array(input.data),
|
|
119
|
+
width: input.width,
|
|
120
|
+
height: input.height,
|
|
121
|
+
};
|
|
126
122
|
}
|
|
127
123
|
let width;
|
|
128
124
|
let height;
|
|
129
|
-
if (input instanceof HTMLImageElement) {
|
|
125
|
+
if (typeof HTMLImageElement !== "undefined" && input instanceof HTMLImageElement) {
|
|
130
126
|
[width, height] = [input.naturalWidth, input.naturalHeight];
|
|
131
127
|
}
|
|
132
|
-
else if (input instanceof HTMLVideoElement) {
|
|
128
|
+
else if (typeof HTMLVideoElement !== "undefined" && input instanceof HTMLVideoElement) {
|
|
133
129
|
[width, height] = [input.videoWidth, input.videoHeight];
|
|
134
130
|
}
|
|
135
131
|
else {
|
|
@@ -139,7 +135,7 @@ function toImageData(input) {
|
|
|
139
135
|
const ctx = get2d(canvas, { willReadFrequently: true });
|
|
140
136
|
ctx.drawImage(input, 0, 0, width, height);
|
|
141
137
|
const img = ctx.getImageData(0, 0, width, height);
|
|
142
|
-
return { data: new Uint8Array(img.data.buffer), width, height };
|
|
138
|
+
return { data: new Uint8Array(img.data.buffer, img.data.byteOffset, img.data.byteLength), width, height };
|
|
143
139
|
}
|
|
144
140
|
function makeCanvas(width, height) {
|
|
145
141
|
if (typeof OffscreenCanvas !== "undefined")
|
|
@@ -233,16 +229,22 @@ class LiteRtBackend {
|
|
|
233
229
|
static async load(tflite, wasmUrl, accelerator) {
|
|
234
230
|
const litert = await importLiteRt();
|
|
235
231
|
await ensureLiteRtRuntime(litert, wasmUrl);
|
|
232
|
+
let model;
|
|
236
233
|
try {
|
|
237
|
-
|
|
238
|
-
return new LiteRtBackend(litert, model, accelerator);
|
|
234
|
+
model = await litert.loadAndCompile(tflite, { accelerator });
|
|
239
235
|
}
|
|
240
236
|
catch (e) {
|
|
241
237
|
if (accelerator === "wasm")
|
|
242
238
|
throw e;
|
|
243
|
-
|
|
244
|
-
return new LiteRtBackend(litert, model, "wasm");
|
|
239
|
+
model = await litert.loadAndCompile(tflite, { accelerator: "wasm" });
|
|
245
240
|
}
|
|
241
|
+
// This runtime is loaded without JSPI. A partially delegated model needs it to
|
|
242
|
+
// switch between GPU and CPU, even when the browser itself supports JSPI.
|
|
243
|
+
if (model.options.accelerator === "webgpu" && !model.isFullyAccelerated) {
|
|
244
|
+
model.delete?.();
|
|
245
|
+
model = await litert.loadAndCompile(tflite, { accelerator: "wasm" });
|
|
246
|
+
}
|
|
247
|
+
return new LiteRtBackend(litert, model, model.options.accelerator);
|
|
246
248
|
}
|
|
247
249
|
/** Upload the input tensor, run, and read every output back to the CPU. */
|
|
248
250
|
async run(input, shape) {
|
|
@@ -254,16 +256,15 @@ class LiteRtBackend {
|
|
|
254
256
|
const tensors = await this.model.run(gpuIn);
|
|
255
257
|
const outputs = [];
|
|
256
258
|
const shapes = [];
|
|
257
|
-
for (const
|
|
258
|
-
const host = await
|
|
259
|
-
//
|
|
260
|
-
|
|
259
|
+
for (const tensor of tensors) {
|
|
260
|
+
const host = await tensor.moveTo("wasm");
|
|
261
|
+
// LiteRT's toTypedArray() already copies the host data.
|
|
262
|
+
const data = host.toTypedArray();
|
|
263
|
+
outputs.push(data instanceof Float32Array ? data : new Float32Array(data));
|
|
261
264
|
shapes.push(Array.from(host.type.layout.dimensions));
|
|
262
265
|
host.delete?.();
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
if (t !== host)
|
|
266
|
-
t.delete?.();
|
|
266
|
+
if (tensor !== host)
|
|
267
|
+
tensor.delete?.();
|
|
267
268
|
}
|
|
268
269
|
return { outputs, shapes, inferenceMs: performance.now() - t0 };
|
|
269
270
|
}
|
|
@@ -307,10 +308,6 @@ class LiteRtEngine {
|
|
|
307
308
|
constructor(pipeline, backend) {
|
|
308
309
|
this.pipeline = pipeline;
|
|
309
310
|
this.backend = backend;
|
|
310
|
-
// `YoloPipeline` keeps exactly one pending frame in wasm state between
|
|
311
|
-
// `preprocess_rgba` and `postprocess`, so predictions must not interleave.
|
|
312
|
-
// Serialize them: a new call waits for the in-flight one to finish.
|
|
313
|
-
this.queue = Promise.resolve();
|
|
314
311
|
}
|
|
315
312
|
get task() {
|
|
316
313
|
return this.pipeline.task;
|
|
@@ -324,32 +321,24 @@ class LiteRtEngine {
|
|
|
324
321
|
return this.pipeline.names;
|
|
325
322
|
}
|
|
326
323
|
predictDrawable(data, width, height, p) {
|
|
327
|
-
return this.
|
|
324
|
+
return this.runDrawable(data, width, height, p);
|
|
328
325
|
}
|
|
329
326
|
/** LiteRT takes raw pixels, so decode encoded inputs to RGBA in JS first. */
|
|
330
|
-
predictEncoded(bytes, p) {
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
}
|
|
340
|
-
});
|
|
327
|
+
async predictEncoded(bytes, p) {
|
|
328
|
+
const bitmap = await createImageBitmap(new Blob([bytes]));
|
|
329
|
+
try {
|
|
330
|
+
const { data, width, height } = toImageData(bitmap);
|
|
331
|
+
return await this.runDrawable(data, width, height, p);
|
|
332
|
+
}
|
|
333
|
+
finally {
|
|
334
|
+
bitmap.close();
|
|
335
|
+
}
|
|
341
336
|
}
|
|
342
337
|
async runDrawable(data, width, height, p) {
|
|
343
338
|
const input = this.pipeline.preprocess_rgba(data, width, height);
|
|
344
339
|
const { outputs, shapes, inferenceMs } = await this.backend.run(input, Array.from(this.pipeline.inputShape));
|
|
345
340
|
return this.pipeline.postprocess(outputs, shapes.map((s) => new Uint32Array(s)), inferenceMs, p.conf, p.iou, p.classes, p.colormap, p.depthViz);
|
|
346
341
|
}
|
|
347
|
-
/** Chain `fn` after any in-flight prediction so wasm frame state is never shared. */
|
|
348
|
-
serialize(fn) {
|
|
349
|
-
const result = this.queue.then(fn, fn);
|
|
350
|
-
this.queue = result.then(() => undefined, () => undefined);
|
|
351
|
-
return result;
|
|
352
|
-
}
|
|
353
342
|
free() {
|
|
354
343
|
this.pipeline.free();
|
|
355
344
|
this.backend.free();
|
|
@@ -362,6 +351,8 @@ class LiteRtEngine {
|
|
|
362
351
|
export class YOLO {
|
|
363
352
|
constructor(engine) {
|
|
364
353
|
this.engine = engine;
|
|
354
|
+
// The wasm models keep mutable per-frame state; run one prediction per model at a time.
|
|
355
|
+
this.queue = Promise.resolve();
|
|
365
356
|
}
|
|
366
357
|
/**
|
|
367
358
|
* Load a model and initialize the inference backend.
|
|
@@ -391,25 +382,7 @@ export class YOLO {
|
|
|
391
382
|
const wasmUrl = options?.litertWasmUrl ? options.litertWasmUrl.toString() : DEFAULT_LITERT_WASM;
|
|
392
383
|
// Honor `device` including `"auto"`, which feature-detects WebGPU (so a
|
|
393
384
|
// browser without it goes straight to wasm instead of a failed compile).
|
|
394
|
-
|
|
395
|
-
// NMS-free exports (YOLO26, `nms=False`) do top-k selection with int64 + gather_nd ops the
|
|
396
|
-
// LiteRT WebGPU delegate cannot run: it fails to invoke and returns zeros.
|
|
397
|
-
// Force CPU/wasm so the model works. For WebGPU speed, re-export the model
|
|
398
|
-
// with Ultralytics >=8.4.142 and `nms=None` for the one-to-many head (NMS in Rust).
|
|
399
|
-
if (accelerator === "webgpu" && pipeline.end2end) {
|
|
400
|
-
accelerator = "wasm";
|
|
401
|
-
console.warn("LiteRT: this is an NMS-free model; its WebGPU delegate can't run the int64 ops, so it runs on CPU/wasm. Re-export with Ultralytics >=8.4.142 and `nms=None` for WebGPU.");
|
|
402
|
-
}
|
|
403
|
-
// RT-DETR's deformable-attention decoder reshapes to rank 5 and indexes with int64,
|
|
404
|
-
// which the LiteRT WebGPU delegate rejects: Vulkan logs a RESHAPE error per offending
|
|
405
|
-
// node and falls back per-op, Metal-3 fails the compile outright. `"auto"` therefore
|
|
406
|
-
// goes straight to wasm and skips the noise and the wasted GPU compile. An explicit
|
|
407
|
-
// `device: "webgpu"` is still honored, so this can be re-tested when the delegate
|
|
408
|
-
// grows the missing ops, without patching the library.
|
|
409
|
-
if (accelerator === "webgpu" && pipeline.rtdetr && options?.device !== "webgpu") {
|
|
410
|
-
accelerator = "wasm";
|
|
411
|
-
console.warn('LiteRT: RT-DETR\'s decoder uses rank-5 reshapes and int64 indices that the WebGPU delegate could not run on the drivers tested, so it runs on CPU/wasm. Pass device: "webgpu" to try it anyway.');
|
|
412
|
-
}
|
|
385
|
+
const accelerator = (await resolveDevice(options?.device)) === "webgpu" ? "webgpu" : "wasm";
|
|
413
386
|
const backend = await LiteRtBackend.load(tflite, wasmUrl, accelerator);
|
|
414
387
|
// The compiled model outranks the metadata: `pipeline.inputShape` is what sizes the
|
|
415
388
|
// input tensor below, so a stale `imgsz` would build one the model rejects.
|
|
@@ -436,7 +409,7 @@ export class YOLO {
|
|
|
436
409
|
* Run inference on an image.
|
|
437
410
|
*
|
|
438
411
|
* Drawable sources (`ImageData`, `HTMLImageElement`, `HTMLCanvasElement`,
|
|
439
|
-
* `HTMLVideoElement`, `ImageBitmap`) take a fast path that reads raw pixels
|
|
412
|
+
* `HTMLVideoElement`, `OffscreenCanvas`, `ImageBitmap`) take a fast path that reads raw pixels
|
|
440
413
|
* with no re-encoding, ideal for webcam/video. URLs, `Blob`s, and raw bytes
|
|
441
414
|
* are decoded (in wasm for `ort`, via a canvas for `litert`).
|
|
442
415
|
*
|
|
@@ -453,12 +426,22 @@ export class YOLO {
|
|
|
453
426
|
colormap: options?.colormap ?? "",
|
|
454
427
|
depthViz: options?.depthViz ?? "",
|
|
455
428
|
};
|
|
429
|
+
let predict;
|
|
456
430
|
if (isDrawable(image)) {
|
|
457
431
|
const { data, width, height } = toImageData(image);
|
|
458
|
-
|
|
432
|
+
predict = () => this.engine.predictDrawable(data, width, height, p);
|
|
459
433
|
}
|
|
460
|
-
|
|
461
|
-
|
|
434
|
+
else {
|
|
435
|
+
const bytes = image instanceof Uint8Array
|
|
436
|
+
? image.slice()
|
|
437
|
+
: image instanceof ArrayBuffer
|
|
438
|
+
? new Uint8Array(image.slice(0))
|
|
439
|
+
: await toBytes(image, "image");
|
|
440
|
+
predict = () => this.engine.predictEncoded(bytes, p);
|
|
441
|
+
}
|
|
442
|
+
const result = this.queue.then(async () => decodeResults(await predict()));
|
|
443
|
+
this.queue = result.then(() => undefined, () => undefined);
|
|
444
|
+
return result;
|
|
462
445
|
}
|
|
463
446
|
/** Release the underlying wasm model/engine. Call when you are done with it. */
|
|
464
447
|
free() {
|
package/package.json
CHANGED
package/pkg/package.json
CHANGED
|
@@ -140,9 +140,7 @@ export class YoloPipeline {
|
|
|
140
140
|
*/
|
|
141
141
|
setInputShape(shape: Int32Array): void;
|
|
142
142
|
/**
|
|
143
|
-
* Whether this is an NMS-free export, e.g. YOLO26 with `nms=False`.
|
|
144
|
-
* top-k selection with `int64`/`gather_nd` ops that the LiteRT WebGPU delegate
|
|
145
|
-
* cannot execute, so such models must run on the CPU (wasm) accelerator.
|
|
143
|
+
* Whether this is an NMS-free export, e.g. YOLO26 with `nms=False`.
|
|
146
144
|
*/
|
|
147
145
|
readonly end2end: boolean;
|
|
148
146
|
/**
|
|
@@ -159,9 +157,7 @@ export class YoloPipeline {
|
|
|
159
157
|
*/
|
|
160
158
|
readonly names: any;
|
|
161
159
|
/**
|
|
162
|
-
* Whether this is an RT-DETR export.
|
|
163
|
-
* rank 5 and indexes with `int64`, neither of which the LiteRT WebGPU delegate
|
|
164
|
-
* supports, so such models must run on the CPU (wasm) accelerator.
|
|
160
|
+
* Whether this is an RT-DETR export.
|
|
165
161
|
*/
|
|
166
162
|
readonly rtdetr: boolean;
|
|
167
163
|
/**
|
|
@@ -207,10 +203,10 @@ export interface InitOutput {
|
|
|
207
203
|
readonly yolopipeline_rtdetr: (a: number) => number;
|
|
208
204
|
readonly yolopipeline_setInputShape: (a: number, b: number, c: number) => void;
|
|
209
205
|
readonly yolopipeline_task: (a: number, b: number) => void;
|
|
210
|
-
readonly
|
|
211
|
-
readonly
|
|
212
|
-
readonly
|
|
213
|
-
readonly
|
|
206
|
+
readonly __wasm_bindgen_func_elem_1192: (a: number, b: number, c: number, d: number) => void;
|
|
207
|
+
readonly __wasm_bindgen_func_elem_1823: (a: number, b: number, c: number, d: number) => void;
|
|
208
|
+
readonly __wasm_bindgen_func_elem_1847: (a: number, b: number, c: number, d: number) => void;
|
|
209
|
+
readonly __wasm_bindgen_func_elem_377: (a: number, b: number, c: number, d: number) => void;
|
|
214
210
|
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
215
211
|
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
216
212
|
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-
|
|
3
|
-
import { trackSessionInit } from './snippets/ort-web-
|
|
2
|
+
import { initRuntime } from './snippets/ort-web-d8e9a032d14319ec/_loader.js';
|
|
3
|
+
import { trackSessionInit } from './snippets/ort-web-d8e9a032d14319ec/_telemetry.js';
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -208,9 +208,7 @@ export class YoloPipeline {
|
|
|
208
208
|
wasm.__wbg_yolopipeline_free(ptr, 0);
|
|
209
209
|
}
|
|
210
210
|
/**
|
|
211
|
-
* Whether this is an NMS-free export, e.g. YOLO26 with `nms=False`.
|
|
212
|
-
* top-k selection with `int64`/`gather_nd` ops that the LiteRT WebGPU delegate
|
|
213
|
-
* cannot execute, so such models must run on the CPU (wasm) accelerator.
|
|
211
|
+
* Whether this is an NMS-free export, e.g. YOLO26 with `nms=False`.
|
|
214
212
|
* @returns {boolean}
|
|
215
213
|
*/
|
|
216
214
|
get end2end() {
|
|
@@ -370,9 +368,7 @@ export class YoloPipeline {
|
|
|
370
368
|
}
|
|
371
369
|
}
|
|
372
370
|
/**
|
|
373
|
-
* Whether this is an RT-DETR export.
|
|
374
|
-
* rank 5 and indexes with `int64`, neither of which the LiteRT WebGPU delegate
|
|
375
|
-
* supports, so such models must run on the CPU (wasm) accelerator.
|
|
371
|
+
* Whether this is an RT-DETR export.
|
|
376
372
|
* @returns {boolean}
|
|
377
373
|
*/
|
|
378
374
|
get rtdetr() {
|
|
@@ -557,25 +553,28 @@ function __wbg_get_imports() {
|
|
|
557
553
|
const ret = getObject(arg0).call(getObject(arg1));
|
|
558
554
|
return addHeapObject(ret);
|
|
559
555
|
}, arguments); },
|
|
560
|
-
|
|
556
|
+
__wbg_create_07db378e252080ec: function() { return handleError(function (arg0, arg1, arg2) {
|
|
561
557
|
const ret = ort.InferenceSession.create(getStringFromWasm0(arg0, arg1), takeObject(arg2));
|
|
562
558
|
return addHeapObject(ret);
|
|
563
559
|
}, arguments); },
|
|
564
|
-
|
|
560
|
+
__wbg_create_573b47018e76ad99: function() { return handleError(function (arg0, arg1) {
|
|
565
561
|
const ret = ort.InferenceSession.create(getObject(arg0), takeObject(arg1));
|
|
566
562
|
return addHeapObject(ret);
|
|
567
563
|
}, arguments); },
|
|
568
|
-
|
|
564
|
+
__wbg_data_e242aa3d2f3b3ce2: function() { return handleError(function (arg0) {
|
|
569
565
|
const ret = getObject(arg0).data;
|
|
570
566
|
return addHeapObject(ret);
|
|
571
567
|
}, arguments); },
|
|
572
|
-
|
|
568
|
+
__wbg_dims_b9c966d20c2a4d79: function(arg0, arg1) {
|
|
573
569
|
const ret = getObject(arg1).dims;
|
|
574
|
-
const ptr1 =
|
|
570
|
+
const ptr1 = passArrayF64ToWasm0(ret, wasm.__wbindgen_export);
|
|
575
571
|
const len1 = WASM_VECTOR_LEN;
|
|
576
572
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
577
573
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
578
574
|
},
|
|
575
|
+
__wbg_dispose_17a92fe091ac456b: function() { return handleError(function (arg0) {
|
|
576
|
+
getObject(arg0).dispose();
|
|
577
|
+
}, arguments); },
|
|
579
578
|
__wbg_done_b41a1d26cdb37fb6: function(arg0) {
|
|
580
579
|
const ret = getObject(arg0).done;
|
|
581
580
|
return ret;
|
|
@@ -599,7 +598,7 @@ function __wbg_get_imports() {
|
|
|
599
598
|
const ret = Array.from(getObject(arg0));
|
|
600
599
|
return addHeapObject(ret);
|
|
601
600
|
},
|
|
602
|
-
|
|
601
|
+
__wbg_getData_ae0be7023598e2c2: function() { return handleError(function (arg0) {
|
|
603
602
|
const ret = getObject(arg0).getData();
|
|
604
603
|
return addHeapObject(ret);
|
|
605
604
|
}, arguments); },
|
|
@@ -623,18 +622,18 @@ function __wbg_get_imports() {
|
|
|
623
622
|
const ret = getObject(arg0)[getObject(arg1)];
|
|
624
623
|
return addHeapObject(ret);
|
|
625
624
|
},
|
|
626
|
-
|
|
625
|
+
__wbg_initRuntime_cfc81535b182a89a: function() { return handleError(function (arg0, arg1) {
|
|
627
626
|
const ret = initRuntime(arg0, takeObject(arg1));
|
|
628
627
|
return addHeapObject(ret);
|
|
629
628
|
}, arguments); },
|
|
630
|
-
|
|
629
|
+
__wbg_inputMetadata_b0480cebe7a00667: function(arg0, arg1) {
|
|
631
630
|
const ret = getObject(arg1).inputMetadata;
|
|
632
631
|
const ptr1 = passArrayJsValueToWasm0(ret, wasm.__wbindgen_export);
|
|
633
632
|
const len1 = WASM_VECTOR_LEN;
|
|
634
633
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
635
634
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
636
635
|
},
|
|
637
|
-
|
|
636
|
+
__wbg_inputNames_2897599e914f9792: function(arg0, arg1) {
|
|
638
637
|
const ret = getObject(arg1).inputNames;
|
|
639
638
|
const ptr1 = passArrayJsValueToWasm0(ret, wasm.__wbindgen_export);
|
|
640
639
|
const len1 = WASM_VECTOR_LEN;
|
|
@@ -661,20 +660,20 @@ function __wbg_get_imports() {
|
|
|
661
660
|
const ret = result;
|
|
662
661
|
return ret;
|
|
663
662
|
},
|
|
664
|
-
|
|
663
|
+
__wbg_instanceof_Performance_cbec0dbedaa91be1: function(arg0) {
|
|
665
664
|
let result;
|
|
666
665
|
try {
|
|
667
|
-
result = getObject(arg0) instanceof
|
|
666
|
+
result = getObject(arg0) instanceof Performance;
|
|
668
667
|
} catch (_) {
|
|
669
668
|
result = false;
|
|
670
669
|
}
|
|
671
670
|
const ret = result;
|
|
672
671
|
return ret;
|
|
673
672
|
},
|
|
674
|
-
|
|
673
|
+
__wbg_instanceof_Uint8Array_828cef2aaacafc31: function(arg0) {
|
|
675
674
|
let result;
|
|
676
675
|
try {
|
|
677
|
-
result = getObject(arg0) instanceof
|
|
676
|
+
result = getObject(arg0) instanceof Uint8Array;
|
|
678
677
|
} catch (_) {
|
|
679
678
|
result = false;
|
|
680
679
|
}
|
|
@@ -709,10 +708,14 @@ function __wbg_get_imports() {
|
|
|
709
708
|
const ret = getObject(arg0).length;
|
|
710
709
|
return ret;
|
|
711
710
|
},
|
|
712
|
-
|
|
711
|
+
__wbg_location_02e5bf0e6b80a0f5: function(arg0) {
|
|
713
712
|
const ret = getObject(arg0).location;
|
|
714
713
|
return (__wbindgen_enum_DataLocation.indexOf(ret) + 1 || 7) - 1;
|
|
715
714
|
},
|
|
715
|
+
__wbg_message_5f8387f0c32b90a7: function(arg0) {
|
|
716
|
+
const ret = getObject(arg0).message;
|
|
717
|
+
return addHeapObject(ret);
|
|
718
|
+
},
|
|
716
719
|
__wbg_new_1dbf7428bba60a42: function(arg0) {
|
|
717
720
|
const ret = new Uint8Array(getObject(arg0));
|
|
718
721
|
return addHeapObject(ret);
|
|
@@ -733,10 +736,14 @@ function __wbg_get_imports() {
|
|
|
733
736
|
const ret = new Array();
|
|
734
737
|
return addHeapObject(ret);
|
|
735
738
|
},
|
|
736
|
-
|
|
739
|
+
__wbg_new_from_buffer_raw_eb33cdffdf32a27b: function() { return handleError(function (arg0, arg1, arg2) {
|
|
737
740
|
const ret = new ort.Tensor(__wbindgen_enum_DataType[arg0], takeObject(arg1), takeObject(arg2));
|
|
738
741
|
return addHeapObject(ret);
|
|
739
742
|
}, arguments); },
|
|
743
|
+
__wbg_new_from_slice_9a868026ffa4208a: function(arg0, arg1) {
|
|
744
|
+
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
745
|
+
return addHeapObject(ret);
|
|
746
|
+
},
|
|
740
747
|
__wbg_new_from_slice_ca6ad97db1f4779a: function(arg0, arg1) {
|
|
741
748
|
const ret = new Float32Array(getArrayF32FromWasm0(arg0, arg1));
|
|
742
749
|
return addHeapObject(ret);
|
|
@@ -748,7 +755,7 @@ function __wbg_get_imports() {
|
|
|
748
755
|
const a = state0.a;
|
|
749
756
|
state0.a = 0;
|
|
750
757
|
try {
|
|
751
|
-
return
|
|
758
|
+
return __wasm_bindgen_func_elem_1847(a, state0.b, arg0, arg1);
|
|
752
759
|
} finally {
|
|
753
760
|
state0.a = a;
|
|
754
761
|
}
|
|
@@ -759,48 +766,44 @@ function __wbg_get_imports() {
|
|
|
759
766
|
state0.a = 0;
|
|
760
767
|
}
|
|
761
768
|
},
|
|
762
|
-
|
|
763
|
-
const ret = new
|
|
769
|
+
__wbg_new_with_byte_offset_and_length_1dc9f6fbbe046da6: function(arg0, arg1, arg2) {
|
|
770
|
+
const ret = new Uint16Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
|
|
764
771
|
return addHeapObject(ret);
|
|
765
772
|
},
|
|
766
|
-
|
|
767
|
-
const ret = new
|
|
768
|
-
return addHeapObject(ret);
|
|
769
|
-
},
|
|
770
|
-
__wbg_new_with_length_1135aa9e3c0fb17c: function(arg0) {
|
|
771
|
-
const ret = new BigUint64Array(arg0 >>> 0);
|
|
773
|
+
__wbg_new_with_byte_offset_and_length_2f5d7fc2a828b74d: function(arg0, arg1, arg2) {
|
|
774
|
+
const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
|
|
772
775
|
return addHeapObject(ret);
|
|
773
776
|
},
|
|
774
|
-
|
|
775
|
-
const ret = new
|
|
777
|
+
__wbg_new_with_byte_offset_and_length_40c170286adc9005: function(arg0, arg1, arg2) {
|
|
778
|
+
const ret = new Float32Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
|
|
776
779
|
return addHeapObject(ret);
|
|
777
780
|
},
|
|
778
|
-
|
|
779
|
-
const ret = new
|
|
781
|
+
__wbg_new_with_byte_offset_and_length_6e8c68600a3ecb84: function(arg0, arg1, arg2) {
|
|
782
|
+
const ret = new BigUint64Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
|
|
780
783
|
return addHeapObject(ret);
|
|
781
784
|
},
|
|
782
|
-
|
|
783
|
-
const ret = new
|
|
785
|
+
__wbg_new_with_byte_offset_and_length_820ea3ecbd1a4828: function(arg0, arg1, arg2) {
|
|
786
|
+
const ret = new Int16Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
|
|
784
787
|
return addHeapObject(ret);
|
|
785
788
|
},
|
|
786
|
-
|
|
787
|
-
const ret = new
|
|
789
|
+
__wbg_new_with_byte_offset_and_length_915c5de4270ab7e5: function(arg0, arg1, arg2) {
|
|
790
|
+
const ret = new Int8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
|
|
788
791
|
return addHeapObject(ret);
|
|
789
792
|
},
|
|
790
|
-
|
|
791
|
-
const ret = new Int32Array(arg0 >>> 0);
|
|
793
|
+
__wbg_new_with_byte_offset_and_length_b93e61c4e9440336: function(arg0, arg1, arg2) {
|
|
794
|
+
const ret = new Int32Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
|
|
792
795
|
return addHeapObject(ret);
|
|
793
796
|
},
|
|
794
|
-
|
|
795
|
-
const ret = new
|
|
797
|
+
__wbg_new_with_byte_offset_and_length_bf3e693fe2fffb6f: function(arg0, arg1, arg2) {
|
|
798
|
+
const ret = new Uint32Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
|
|
796
799
|
return addHeapObject(ret);
|
|
797
800
|
},
|
|
798
|
-
|
|
799
|
-
const ret = new
|
|
801
|
+
__wbg_new_with_byte_offset_and_length_c14d867a5878f875: function(arg0, arg1, arg2) {
|
|
802
|
+
const ret = new BigInt64Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
|
|
800
803
|
return addHeapObject(ret);
|
|
801
804
|
},
|
|
802
|
-
|
|
803
|
-
const ret = new
|
|
805
|
+
__wbg_new_with_byte_offset_and_length_edf873b0b3173456: function(arg0, arg1, arg2) {
|
|
806
|
+
const ret = new Float64Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
|
|
804
807
|
return addHeapObject(ret);
|
|
805
808
|
},
|
|
806
809
|
__wbg_next_33784799010f1bbe: function(arg0) {
|
|
@@ -815,14 +818,14 @@ function __wbg_get_imports() {
|
|
|
815
818
|
const ret = getObject(arg0).now();
|
|
816
819
|
return ret;
|
|
817
820
|
},
|
|
818
|
-
|
|
821
|
+
__wbg_outputMetadata_d74fba311b0cce30: function(arg0, arg1) {
|
|
819
822
|
const ret = getObject(arg1).outputMetadata;
|
|
820
823
|
const ptr1 = passArrayJsValueToWasm0(ret, wasm.__wbindgen_export);
|
|
821
824
|
const len1 = WASM_VECTOR_LEN;
|
|
822
825
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
823
826
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
824
827
|
},
|
|
825
|
-
|
|
828
|
+
__wbg_outputNames_26deb7d052bac410: function(arg0, arg1) {
|
|
826
829
|
const ret = getObject(arg1).outputNames;
|
|
827
830
|
const ptr1 = passArrayJsValueToWasm0(ret, wasm.__wbindgen_export);
|
|
828
831
|
const len1 = WASM_VECTOR_LEN;
|
|
@@ -833,10 +836,6 @@ function __wbg_get_imports() {
|
|
|
833
836
|
const ret = Reflect.ownKeys(getObject(arg0));
|
|
834
837
|
return addHeapObject(ret);
|
|
835
838
|
}, arguments); },
|
|
836
|
-
__wbg_performance_d0d7b03fc649b694: function(arg0) {
|
|
837
|
-
const ret = getObject(arg0).performance;
|
|
838
|
-
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
839
|
-
},
|
|
840
839
|
__wbg_prototypesetcall_06eb15da165dee8f: function(arg0, arg1, arg2) {
|
|
841
840
|
Uint32Array.prototype.set.call(getArrayU32FromWasm0(arg0, arg1), getObject(arg2));
|
|
842
841
|
},
|
|
@@ -857,18 +856,25 @@ function __wbg_get_imports() {
|
|
|
857
856
|
__wbg_queueMicrotask_a72f977e97f23c5f: function(arg0) {
|
|
858
857
|
queueMicrotask(getObject(arg0));
|
|
859
858
|
},
|
|
859
|
+
__wbg_release_0dd02e33b7cd324c: function() { return handleError(function (arg0) {
|
|
860
|
+
const ret = getObject(arg0).release();
|
|
861
|
+
return addHeapObject(ret);
|
|
862
|
+
}, arguments); },
|
|
860
863
|
__wbg_resolve_0076e10020304ede: function(arg0) {
|
|
861
864
|
const ret = Promise.resolve(getObject(arg0));
|
|
862
865
|
return addHeapObject(ret);
|
|
863
866
|
},
|
|
864
|
-
|
|
865
|
-
const ret = getObject(arg0).run(takeObject(arg1));
|
|
867
|
+
__wbg_run_2893666784c8891d: function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
868
|
+
const ret = getObject(arg0).run(takeObject(arg1), takeObject(arg2), takeObject(arg3));
|
|
866
869
|
return addHeapObject(ret);
|
|
867
870
|
}, arguments); },
|
|
868
871
|
__wbg_set_145a351398b48c65: function() { return handleError(function (arg0, arg1, arg2) {
|
|
869
872
|
const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
|
|
870
873
|
return ret;
|
|
871
874
|
}, arguments); },
|
|
875
|
+
__wbg_set_34d08fd992d43d61: function(arg0, arg1, arg2) {
|
|
876
|
+
getObject(arg0).set(getObject(arg1), arg2 >>> 0);
|
|
877
|
+
},
|
|
872
878
|
__wbg_set_575d3ddb70fe831d: function(arg0, arg1, arg2) {
|
|
873
879
|
getObject(arg0).set(getArrayU8FromWasm0(arg1, arg2));
|
|
874
880
|
},
|
|
@@ -924,11 +930,11 @@ function __wbg_get_imports() {
|
|
|
924
930
|
const ret = getObject(arg0).toString();
|
|
925
931
|
return addHeapObject(ret);
|
|
926
932
|
},
|
|
927
|
-
|
|
933
|
+
__wbg_trackSessionInit_b37a6598a5541f10: function() { return handleError(function (arg0, arg1) {
|
|
928
934
|
const ret = trackSessionInit(getStringFromWasm0(arg0, arg1));
|
|
929
935
|
return addHeapObject(ret);
|
|
930
936
|
}, arguments); },
|
|
931
|
-
|
|
937
|
+
__wbg_type_e1fd5cc29b264a06: function(arg0) {
|
|
932
938
|
const ret = getObject(arg0).type;
|
|
933
939
|
return (__wbindgen_enum_DataType.indexOf(ret) + 1 || 16) - 1;
|
|
934
940
|
},
|
|
@@ -941,18 +947,18 @@ function __wbg_get_imports() {
|
|
|
941
947
|
return addHeapObject(ret);
|
|
942
948
|
},
|
|
943
949
|
__wbindgen_generic_0000000000000001: function(arg0, arg1) {
|
|
944
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
945
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
950
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 364, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
951
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_1192);
|
|
946
952
|
return addHeapObject(ret);
|
|
947
953
|
},
|
|
948
954
|
__wbindgen_generic_0000000000000002: function(arg0, arg1) {
|
|
949
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
950
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
955
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 648, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
956
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_1823);
|
|
951
957
|
return addHeapObject(ret);
|
|
952
958
|
},
|
|
953
959
|
__wbindgen_generic_0000000000000003: function(arg0, arg1) {
|
|
954
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("boolean")], shim_idx:
|
|
955
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
960
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("boolean")], shim_idx: 21, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
961
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_377);
|
|
956
962
|
return addHeapObject(ret);
|
|
957
963
|
},
|
|
958
964
|
__wbindgen_generic_0000000000000004: function(arg0) {
|
|
@@ -1039,14 +1045,14 @@ function __wbg_get_imports() {
|
|
|
1039
1045
|
};
|
|
1040
1046
|
}
|
|
1041
1047
|
|
|
1042
|
-
function
|
|
1043
|
-
wasm.
|
|
1048
|
+
function __wasm_bindgen_func_elem_1847(arg0, arg1, arg2, arg3) {
|
|
1049
|
+
wasm.__wasm_bindgen_func_elem_1847(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
1044
1050
|
}
|
|
1045
1051
|
|
|
1046
|
-
function
|
|
1052
|
+
function __wasm_bindgen_func_elem_1192(arg0, arg1, arg2) {
|
|
1047
1053
|
try {
|
|
1048
1054
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1049
|
-
wasm.
|
|
1055
|
+
wasm.__wasm_bindgen_func_elem_1192(retptr, arg0, arg1, addHeapObject(arg2));
|
|
1050
1056
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1051
1057
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1052
1058
|
if (r1) {
|
|
@@ -1057,10 +1063,10 @@ function __wasm_bindgen_func_elem_1159(arg0, arg1, arg2) {
|
|
|
1057
1063
|
}
|
|
1058
1064
|
}
|
|
1059
1065
|
|
|
1060
|
-
function
|
|
1066
|
+
function __wasm_bindgen_func_elem_1823(arg0, arg1, arg2) {
|
|
1061
1067
|
try {
|
|
1062
1068
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1063
|
-
wasm.
|
|
1069
|
+
wasm.__wasm_bindgen_func_elem_1823(retptr, arg0, arg1, addHeapObject(arg2));
|
|
1064
1070
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1065
1071
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1066
1072
|
if (r1) {
|
|
@@ -1071,10 +1077,10 @@ function __wasm_bindgen_func_elem_1786(arg0, arg1, arg2) {
|
|
|
1071
1077
|
}
|
|
1072
1078
|
}
|
|
1073
1079
|
|
|
1074
|
-
function
|
|
1080
|
+
function __wasm_bindgen_func_elem_377(arg0, arg1, arg2) {
|
|
1075
1081
|
try {
|
|
1076
1082
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1077
|
-
wasm.
|
|
1083
|
+
wasm.__wasm_bindgen_func_elem_377(retptr, arg0, arg1, addHeapObject(arg2));
|
|
1078
1084
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1079
1085
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1080
1086
|
if (r1) {
|
|
@@ -1377,16 +1383,16 @@ function passArray32ToWasm0(arg, malloc) {
|
|
|
1377
1383
|
return ptr;
|
|
1378
1384
|
}
|
|
1379
1385
|
|
|
1380
|
-
function
|
|
1381
|
-
const ptr = malloc(arg.length *
|
|
1382
|
-
|
|
1386
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
1387
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
1388
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
1383
1389
|
WASM_VECTOR_LEN = arg.length;
|
|
1384
1390
|
return ptr;
|
|
1385
1391
|
}
|
|
1386
1392
|
|
|
1387
|
-
function
|
|
1388
|
-
const ptr = malloc(arg.length *
|
|
1389
|
-
|
|
1393
|
+
function passArrayF64ToWasm0(arg, malloc) {
|
|
1394
|
+
const ptr = malloc(arg.length * 8, 8) >>> 0;
|
|
1395
|
+
getFloat64ArrayMemory0().set(arg, ptr / 8);
|
|
1390
1396
|
WASM_VECTOR_LEN = arg.length;
|
|
1391
1397
|
return ptr;
|
|
1392
1398
|
}
|
|
Binary file
|
|
@@ -20,10 +20,10 @@ export const yolopipeline_preprocess_rgba: (a: number, b: number, c: number, d:
|
|
|
20
20
|
export const yolopipeline_rtdetr: (a: number) => number;
|
|
21
21
|
export const yolopipeline_setInputShape: (a: number, b: number, c: number) => void;
|
|
22
22
|
export const yolopipeline_task: (a: number, b: number) => void;
|
|
23
|
-
export const
|
|
24
|
-
export const
|
|
25
|
-
export const
|
|
26
|
-
export const
|
|
23
|
+
export const __wasm_bindgen_func_elem_1192: (a: number, b: number, c: number, d: number) => void;
|
|
24
|
+
export const __wasm_bindgen_func_elem_1823: (a: number, b: number, c: number, d: number) => void;
|
|
25
|
+
export const __wasm_bindgen_func_elem_1847: (a: number, b: number, c: number, d: number) => void;
|
|
26
|
+
export const __wasm_bindgen_func_elem_377: (a: number, b: number, c: number, d: number) => void;
|
|
27
27
|
export const __wbindgen_export: (a: number, b: number) => number;
|
|
28
28
|
export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
29
29
|
export const __wbindgen_export3: (a: number) => void;
|
|
File without changes
|
|
File without changes
|