web-sdk-pp-detection 0.2.0 → 0.3.0

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
@@ -4,15 +4,15 @@
4
4
 
5
5
  基于 ONNX Runtime Web 的浏览器端 PP-Detection 目标检测 SDK,支持 PC、移动端与各类 H5 页面。
6
6
 
7
- 当前 SDK 版本为 **0.2.0**,完整变更见[发布说明](https://github.com/chenmohan123/web-sdk-PP-Detection/blob/main/docs/zh-CN/release-0.2.0.md)。
7
+ 当前 SDK 版本为 **0.3.0**,完整变更见[发布说明](https://github.com/chenmohan123/web-sdk-PP-Detection/blob/main/docs/zh-CN/release-0.3.0.md)。
8
8
 
9
9
  ## 安装
10
10
 
11
11
  ```bash
12
- pnpm add web-sdk-pp-detection@0.2.0
12
+ pnpm add web-sdk-pp-detection@0.3.0
13
13
  ```
14
14
 
15
- 也可以使用 `npm install web-sdk-pp-detection@0.2.0`。
15
+ 也可以使用 `npm install web-sdk-pp-detection@0.3.0`。
16
16
 
17
17
  ## 快速开始
18
18
 
@@ -82,15 +82,15 @@ const detector = await createPPDetection({
82
82
 
83
83
  A browser-first PP-Detection object detection SDK powered by ONNX Runtime Web for desktop, mobile, and H5 pages.
84
84
 
85
- The current SDK version is **0.2.0**. See the [release notes](https://github.com/chenmohan123/web-sdk-PP-Detection/blob/main/docs/en/release-0.2.0.md) for the complete changes.
85
+ The current SDK version is **0.3.0**. See the [release notes](https://github.com/chenmohan123/web-sdk-PP-Detection/blob/main/docs/en/release-0.3.0.md) for the complete changes.
86
86
 
87
87
  ### Installation
88
88
 
89
89
  ```bash
90
- pnpm add web-sdk-pp-detection@0.2.0
90
+ pnpm add web-sdk-pp-detection@0.3.0
91
91
  ```
92
92
 
93
- `npm install web-sdk-pp-detection@0.2.0` is also supported.
93
+ `npm install web-sdk-pp-detection@0.3.0` is also supported.
94
94
 
95
95
  ### Quick start
96
96
 
@@ -149,6 +149,10 @@ From 0.2.0, without an active detector, `ModelManager.getCacheEstimate({ id, ver
149
149
 
150
150
  WeChat official-account pages and other H5/WebView integrations are supported. Native Mini Program inference is not claimed; a native Mini Program should host the H5 experience in a WebView or use server-side inference.
151
151
 
152
+ ### PP-YOLOE 稳定模型(0.3.0 起)
153
+
154
+ 0.3.0 配套提供 PP-YOLOE+ S 640 FP32 `0.1.0 stable` 清单,模型从 ModelScope 或 Hugging Face 的固定 revision 下载,npm 包不包含权重。见[模型接入](https://github.com/chenmohan123/web-sdk-PP-Detection/blob/v0.3.0/examples/ppyoloe-candidate/README.md)。`allowExperimental` 默认关闭,仅运行 labs 候选时显式开启;blocked 仍被拒绝。Demo 默认 PicoDet,两个模型均默认 ModelScope。
155
+
152
156
  ### Documentation
153
157
 
154
158
  - [Chinese documentation](https://github.com/chenmohan123/web-sdk-PP-Detection#readme)
@@ -15667,13 +15667,19 @@ ${u}`, c = n.createShaderModule({ code: d, label: e.name });
15667
15667
  if (executionMode === "worker" && !capabilities.worker) {
15668
15668
  fail("CAPABILITY_UNSUPPORTED", "\u8BF7\u6C42\u7684 worker \u4E0D\u53EF\u7528", { executionMode });
15669
15669
  }
15670
- const variant3 = manifest.variants?.find(
15671
- (candidate) => candidate.precision === requestedPrecision && candidate.status !== "labs" && candidate.status !== "blocked"
15672
- );
15670
+ const matchingVariants = manifest.variants?.filter(
15671
+ (candidate) => candidate.precision === requestedPrecision && candidate.status !== "blocked"
15672
+ ) ?? [];
15673
+ const variant3 = matchingVariants.find((candidate) => candidate.status !== "labs") ?? (options.allowExperimental === true ? matchingVariants.find((candidate) => candidate.status === "labs") : void 0);
15673
15674
  if (!variant3) {
15674
- fail("MODEL_INCOMPATIBLE", `manifest \u6CA1\u6709\u53EF\u7528\u7684 ${requestedPrecision} \u7A33\u5B9A\u53D8\u4F53`, {
15675
- requestedPrecision
15676
- });
15675
+ fail(
15676
+ "MODEL_INCOMPATIBLE",
15677
+ options.allowExperimental === true ? `manifest \u6CA1\u6709\u53EF\u7528\u7684 ${requestedPrecision} \u53D8\u4F53` : `manifest \u6CA1\u6709\u53EF\u7528\u7684 ${requestedPrecision} \u7A33\u5B9A\u53D8\u4F53`,
15678
+ {
15679
+ requestedPrecision,
15680
+ allowExperimental: options.allowExperimental === true
15681
+ }
15682
+ );
15677
15683
  }
15678
15684
  const candidates = candidatesForBackend(requestedBackend, capabilities).filter(
15679
15685
  (backend) => variant3.backends.includes(backend)
@@ -15849,7 +15855,7 @@ ${u}`, c = n.createShaderModule({ code: d, label: e.name });
15849
15855
  };
15850
15856
 
15851
15857
  // src/index.ts
15852
- var CURRENT_SDK_VERSION = "0.2.0";
15858
+ var CURRENT_SDK_VERSION = "0.3.0";
15853
15859
  function probePPDetectionCapabilities(options = {}) {
15854
15860
  return probeCapabilities(options);
15855
15861
  }
@@ -15964,6 +15970,7 @@ ${u}`, c = n.createShaderModule({ code: d, label: e.name });
15964
15970
  options.onProgress?.({ phase: "manifest", status: "complete" });
15965
15971
  const plan = selectExecutionPlan(
15966
15972
  {
15973
+ allowExperimental: options.allowExperimental,
15967
15974
  backend: options.backend,
15968
15975
  precision: options.precision === "auto" ? void 0 : options.precision,
15969
15976
  executionMode: options.executionMode,