@camstack/addon-model-studio 1.0.4 → 1.0.5

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.
Files changed (29) hide show
  1. package/dist/MaskShapeCanvas-C4g96eMz.mjs +13806 -0
  2. package/dist/MotionZonesSettings-B8ishTpw.mjs +309 -0
  3. package/dist/PrivacyMaskSettings-P06be0E2.mjs +290 -0
  4. package/dist/_stub.js +8968 -0
  5. package/dist/_virtual_mf-localSharedImportMap___mfe_internal__addon_model_studio_page-CI4Ho-xh.mjs +156 -0
  6. package/dist/_virtual_mf___mfe_internal__addon_model_studio_page__loadShare___mf_0_camstack_mf_1_sdk__loadShare__.js-ZNPquRb4.mjs +25 -0
  7. package/dist/_virtual_mf___mfe_internal__addon_model_studio_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-cUKFrqHE.mjs +26 -0
  8. package/dist/_virtual_mf___mfe_internal__addon_model_studio_page__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-B-9Pn2K0.mjs +25 -0
  9. package/dist/_virtual_mf___mfe_internal__addon_model_studio_page__loadShare___mf_0_trpc_mf_1_client__loadShare__.js-nybV3Y4f.mjs +25 -0
  10. package/dist/_virtual_mf___mfe_internal__addon_model_studio_page__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.js-BvzT760A.mjs +26 -0
  11. package/dist/_virtual_mf___mfe_internal__addon_model_studio_page__loadShare__react__loadShare__.js-DJDHChgO.mjs +70 -0
  12. package/dist/_virtual_mf___mfe_internal__addon_model_studio_page__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-ds_Ehzaa.mjs +26 -0
  13. package/dist/_virtual_mf___mfe_internal__addon_model_studio_page__loadShare__react_mf_2_dom__loadShare__.js-Dh0QbaoP.mjs +26 -0
  14. package/dist/_virtual_mf___mfe_internal__addon_model_studio_page__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-BjUy5evk.mjs +25 -0
  15. package/dist/addon-model-studio.css +3 -0
  16. package/dist/hostInit-I8461iVN.mjs +129 -0
  17. package/dist/model-studio.addon.js +56 -5
  18. package/dist/model-studio.addon.mjs +56 -5
  19. package/dist/player-overlays-CeF0YjKF.mjs +163 -0
  20. package/dist/remoteEntry.js +2 -0
  21. package/dist/remoteEntry.ssr.js +33 -0
  22. package/dist/rolldown-runtime-HEgqtunE.mjs +20 -0
  23. package/dist/trash-2-Ct7_ZXVk.mjs +49 -0
  24. package/dist/virtualExposes-CWSi4E_g.mjs +27 -0
  25. package/dist/virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_model_studio_page__remoteEntry_js-C-Qc_p47.mjs +2857 -0
  26. package/dist/virtual_mf-exposes-ssr___mfe_internal__addon_model_studio_page__remoteEntry_js-BoA99BYM.mjs +10 -0
  27. package/package.json +30 -3
  28. package/python/convert_lib.py +38 -3
  29. package/python/requirements.txt +10 -0
@@ -0,0 +1,10 @@
1
+ //#region virtual:mf-exposes-ssr:__mfe_internal__addon_model_studio_page__remoteEntry_js
2
+ var e = { "./page": async () => {
3
+ let e = await import("./_stub.js"), t = {};
4
+ return Object.assign(t, e), Object.defineProperty(t, "__esModule", {
5
+ value: !0,
6
+ enumerable: !1
7
+ }), t;
8
+ } };
9
+ //#endregion
10
+ export { e as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-model-studio",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Custom detection model registry, conversion & distribution for CamStack",
5
5
  "keywords": [
6
6
  "camstack",
@@ -45,6 +45,19 @@
45
45
  },
46
46
  {
47
47
  "name": "model-convert"
48
+ },
49
+ {
50
+ "name": "addon-pages-source"
51
+ }
52
+ ],
53
+ "pages": [
54
+ {
55
+ "id": "model-studio",
56
+ "label": "Model Studio",
57
+ "icon": "boxes",
58
+ "path": "/addon/model-studio",
59
+ "remoteName": "addon_model_studio_page",
60
+ "bundle": "remoteEntry.js"
48
61
  }
49
62
  ],
50
63
  "python": {
@@ -59,16 +72,30 @@
59
72
  "python"
60
73
  ],
61
74
  "scripts": {
62
- "build": "vite build",
75
+ "build": "vite build && vite build -c vite.page.config.ts",
76
+ "build:server": "vite build",
77
+ "build:page": "vite build -c vite.page.config.ts",
78
+ "dev:page": "vite -c vite.page.config.ts",
63
79
  "typecheck": "tsc --noEmit",
64
80
  "test": "vitest run",
65
81
  "publish": "npm publish --access public"
66
82
  },
67
83
  "peerDependencies": {
68
- "@camstack/types": "*"
84
+ "@camstack/types": "*",
85
+ "react": ">=18",
86
+ "react-dom": ">=18"
69
87
  },
70
88
  "devDependencies": {
71
89
  "@camstack/types": "*",
90
+ "@camstack/ui-library": "*",
91
+ "@module-federation/vite": "^1.16.9",
92
+ "@tailwindcss/vite": "^4.2.0",
93
+ "@trpc/client": "^11.16.0",
94
+ "@vitejs/plugin-react": "^6.0.2",
95
+ "react": "^19.0.0",
96
+ "react-dom": "^19.0.0",
97
+ "superjson": "^2.0.0",
98
+ "tailwindcss": "^4.2.0",
72
99
  "typescript": "~6.0.3",
73
100
  "vite": "^8.0.11",
74
101
  "vitest": "^3.0.0",
@@ -66,10 +66,45 @@ def quantize_openvino_int8(
66
66
 
67
67
 
68
68
  def export_coreml_from_onnx(onnx_path: str, out_pkg: str, imgsz: int) -> None:
69
- """ONNX -> CoreML mlpackage via coremltools (darwin only)."""
69
+ """ONNX -> CoreML mlpackage (darwin only).
70
+
71
+ Modern coremltools (>=6) dropped the ONNX frontend entirely — ``ct.convert``
72
+ only accepts TensorFlow / PyTorch / MIL sources, so feeding it an ``.onnx``
73
+ raises "Unable to determine the type of the model". We bridge through
74
+ PyTorch: ``onnx2torch`` rebuilds the ONNX graph as an ``nn.Module``, we trace
75
+ it with a representative image input, then coremltools converts the
76
+ TorchScript. Image models are NCHW ``(1, 3, imgsz, imgsz)``.
77
+
78
+ Dynamic-shape models (e.g. YOLO) emit ``Shape`` ops that coremltools' Torch
79
+ converter cannot lower ("Converter is not implemented … 'Shape'"). We first
80
+ run onnx-simplifier with the input shape pinned, which constant-folds those
81
+ Shape ops away, so the traced graph is static and convertible.
82
+ """
70
83
  import coremltools as ct
71
- mlmodel = ct.converters.onnx.convert(model=onnx_path) if hasattr(ct.converters, "onnx") \
72
- else ct.convert(onnx_path, minimum_deployment_target=ct.target.iOS16)
84
+ import onnx
85
+ import torch
86
+ from onnx2torch import convert as onnx_to_torch
87
+ from onnxsim import simplify
88
+
89
+ onnx_model = onnx.load(onnx_path)
90
+ input_name = onnx_model.graph.input[0].name
91
+ simplified, ok = simplify(
92
+ onnx_model, overwrite_input_shapes={input_name: [1, 3, imgsz, imgsz]}
93
+ )
94
+ if not ok:
95
+ simplified = onnx_model # fall back to the original if simplify bailed
96
+
97
+ model = onnx_to_torch(simplified).eval()
98
+ example = torch.rand(1, 3, imgsz, imgsz)
99
+ with torch.no_grad():
100
+ traced = torch.jit.trace(model, example, strict=False)
101
+
102
+ mlmodel = ct.convert(
103
+ traced,
104
+ source="pytorch",
105
+ inputs=[ct.TensorType(name="input", shape=example.shape)],
106
+ minimum_deployment_target=ct.target.iOS16,
107
+ )
73
108
  Path(out_pkg).parent.mkdir(parents=True, exist_ok=True)
74
109
  mlmodel.save(out_pkg)
75
110
 
@@ -12,3 +12,13 @@ onnx
12
12
  openvino>=2025,<2026 ; platform_system != "Darwin"
13
13
  nncf>=2.14 ; platform_system != "Darwin"
14
14
  coremltools>=8.0,<9 ; platform_system == "Darwin"
15
+ # coremltools dropped the ONNX frontend, so ONNX->CoreML bridges through PyTorch
16
+ # (onnx2torch rebuilds the graph as an nn.Module → trace → ct.convert). macOS-only,
17
+ # matching coremltools; convert_lib imports them lazily inside the CoreML path.
18
+ # torch upper-bounded to what coremltools 8.x has tested (≤2.5); newer torch
19
+ # trips "has not been tested" + unimplemented-op converter errors.
20
+ torch>=2.2,<2.6 ; platform_system == "Darwin"
21
+ onnx2torch>=1.5 ; platform_system == "Darwin"
22
+ # onnx-simplifier constant-folds dynamic Shape ops (pinned input) so YOLO-style
23
+ # graphs trace to a static module coremltools can lower.
24
+ onnxsim>=0.4 ; platform_system == "Darwin"