@ultralytics/yolo 0.0.33 → 0.0.35

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
@@ -118,7 +118,7 @@ async function frame() {
118
118
  ## ✨ Models
119
119
 
120
120
  <a href="https://docs.ultralytics.com/tasks" target="_blank">
121
- <img width="100%" src="https://raw.githubusercontent.com/ultralytics/assets/main/docs/ultralytics-yolov8-tasks-banner.avif" alt="Ultralytics YOLO supported tasks">
121
+ <img width="100%" src="https://cdn.ul.run/i/c99d914c3958d0755b5a3d7204b6f24a.avif" alt="Ultralytics YOLO supported tasks">
122
122
  </a>
123
123
  <br>
124
124
  <br>
@@ -299,7 +299,7 @@ Notes:
299
299
  If you load an end2end `.tflite` anyway, the backend auto-switches it to wasm
300
300
  (slower) and logs a warning rather than returning empty results.
301
301
 
302
- - **Tasks**: detect, segment, pose, obb, classify, and semantic are all supported.
302
+ - **Tasks**: detect, segment, pose, obb, classify, semantic, and depth are all supported.
303
303
  - **Cross-origin isolation**: LiteRT's threaded wasm wants `SharedArrayBuffer`,
304
304
  so serve with `Cross-Origin-Opener-Policy: same-origin` and
305
305
  `Cross-Origin-Embedder-Policy: require-corp`.
@@ -316,7 +316,7 @@ npm run build # wasm-pack build + tsc
316
316
  Serve the built package over `localhost` (a secure context) with the two
317
317
  cross-origin isolation headers above, then open it in a WebGPU browser.
318
318
 
319
- ## 💡 Contributing
319
+ ## 💡 Contribute
320
320
 
321
321
  Ultralytics thrives on community collaboration, and we deeply value your contributions! Whether it's reporting bugs,
322
322
  suggesting features, or submitting code changes, your involvement is crucial.
@@ -330,7 +330,7 @@ A heartfelt thank you 🙏 goes out to all our contributors! Your efforts help m
330
330
 
331
331
  [![Ultralytics open-source contributors](https://raw.githubusercontent.com/ultralytics/assets/main/im/image-contributors.png)](https://github.com/ultralytics/ultralytics/graphs/contributors)
332
332
 
333
- ## 📜 License
333
+ ## 📄 License
334
334
 
335
335
  Ultralytics offers two licensing options to suit different needs:
336
336
 
package/README.zh-CN.md CHANGED
@@ -112,7 +112,7 @@ async function frame() {
112
112
  ## ✨ 模型
113
113
 
114
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 支持的任务">
115
+ <img width="100%" src="https://cdn.ul.run/i/c99d914c3958d0755b5a3d7204b6f24a.avif" alt="Ultralytics YOLO 支持的任务">
116
116
  </a>
117
117
  <br>
118
118
  <br>
@@ -274,7 +274,7 @@ wasm 默认从 jsDelivr CDN 加载;向 `YOLO.load` 传入 `litertWasmUrl: "/li
274
274
 
275
275
  如果仍然加载了 end2end 的 `.tflite`,后端会自动切换到 wasm(较慢)并打印警告,而不是返回空结果。
276
276
 
277
- - **支持的任务**:detect、segment、pose、obb、classify 和 semantic 均已支持。
277
+ - **支持的任务**:detect、segment、pose、obb、classify、semantic 和 depth 均已支持。
278
278
  - **跨源隔离**:LiteRT 的多线程 wasm 需要 `SharedArrayBuffer`,因此请以
279
279
  `Cross-Origin-Opener-Policy: same-origin` 和 `Cross-Origin-Embedder-Policy: require-corp`
280
280
  提供服务。
@@ -303,7 +303,7 @@ Ultralytics 依靠社区协作持续发展,我们重视每一份贡献。无
303
303
 
304
304
  [![Ultralytics 开源贡献者](https://raw.githubusercontent.com/ultralytics/assets/main/im/image-contributors.png)](https://github.com/ultralytics/ultralytics/graphs/contributors)
305
305
 
306
- ## 📜 许可证
306
+ ## 📄 许可证
307
307
 
308
308
  Ultralytics 提供两种许可方式:
309
309
 
package/dist/index.js CHANGED
@@ -25,21 +25,19 @@ function poseScheme() {
25
25
  return poseSchemeCache;
26
26
  }
27
27
  /**
28
- * Resolve the device string passed to wasm. An explicit choice is honored;
29
- * `"auto"` feature-detects a WebGPU adapter and otherwise falls back to CPU.
28
+ * Resolve the device string passed to wasm. `"cpu"` is honored as-is; anything else
29
+ * needs a real adapter, since `navigator.gpu` can exist while `requestAdapter()`
30
+ * still returns `null` — so `YOLO.device` reports what actually ran.
30
31
  */
31
32
  async function resolveDevice(pref) {
32
- if (pref === "cpu" || pref === "webgpu")
33
- return pref;
34
- const gpu = navigator.gpu;
35
- if (!gpu)
36
- return "cpu";
37
- try {
38
- return (await gpu.requestAdapter()) ? "webgpu" : "cpu";
39
- }
40
- catch {
33
+ if (pref === "cpu")
41
34
  return "cpu";
42
- }
35
+ const gpu = navigator.gpu;
36
+ if (await gpu?.requestAdapter().catch(() => null))
37
+ return "webgpu";
38
+ if (pref === "webgpu")
39
+ console.warn("[@ultralytics/yolo] WebGPU requested but no adapter found; running on CPU.");
40
+ return "cpu";
43
41
  }
44
42
  /** Ultralytics model assets release (ONNX exports of yolo26 / yolo11 / yolov8). */
45
43
  const ASSETS = "https://github.com/ultralytics/assets/releases/download/v8.4.0/";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultralytics/yolo",
3
- "version": "0.0.33",
3
+ "version": "0.0.35",
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.33",
5
+ "version": "0.0.35",
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;