@camstack/addon-vision 0.1.2 → 0.1.3

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 (110) hide show
  1. package/dist/addons/animal-classifier/index.js +999 -822
  2. package/dist/addons/animal-classifier/index.js.map +1 -1
  3. package/dist/addons/animal-classifier/index.mjs +242 -7
  4. package/dist/addons/animal-classifier/index.mjs.map +1 -1
  5. package/dist/addons/audio-classification/index.js +501 -378
  6. package/dist/addons/audio-classification/index.js.map +1 -1
  7. package/dist/addons/audio-classification/index.mjs +224 -4
  8. package/dist/addons/audio-classification/index.mjs.map +1 -1
  9. package/dist/addons/bird-global-classifier/index.js +1002 -825
  10. package/dist/addons/bird-global-classifier/index.js.map +1 -1
  11. package/dist/addons/bird-global-classifier/index.mjs +248 -7
  12. package/dist/addons/bird-global-classifier/index.mjs.map +1 -1
  13. package/dist/addons/bird-nabirds-classifier/index.js +1002 -825
  14. package/dist/addons/bird-nabirds-classifier/index.js.map +1 -1
  15. package/dist/addons/bird-nabirds-classifier/index.mjs +289 -7
  16. package/dist/addons/bird-nabirds-classifier/index.mjs.map +1 -1
  17. package/dist/addons/face-detection/index.js +1196 -934
  18. package/dist/addons/face-detection/index.js.map +1 -1
  19. package/dist/addons/face-detection/index.mjs +227 -7
  20. package/dist/addons/face-detection/index.mjs.map +1 -1
  21. package/dist/addons/face-recognition/index.js +1003 -807
  22. package/dist/addons/face-recognition/index.js.map +1 -1
  23. package/dist/addons/face-recognition/index.mjs +197 -6
  24. package/dist/addons/face-recognition/index.mjs.map +1 -1
  25. package/dist/addons/motion-detection/index.js +214 -111
  26. package/dist/addons/motion-detection/index.js.map +1 -1
  27. package/dist/addons/motion-detection/index.mjs +12 -9
  28. package/dist/addons/motion-detection/index.mjs.map +1 -1
  29. package/dist/addons/object-detection/index.js +1287 -1082
  30. package/dist/addons/object-detection/index.js.map +1 -1
  31. package/dist/addons/object-detection/index.mjs +373 -7
  32. package/dist/addons/object-detection/index.mjs.map +1 -1
  33. package/dist/addons/plate-detection/index.js +1075 -868
  34. package/dist/addons/plate-detection/index.js.map +1 -1
  35. package/dist/addons/plate-detection/index.mjs +230 -7
  36. package/dist/addons/plate-detection/index.mjs.map +1 -1
  37. package/dist/addons/plate-recognition/index.js +684 -505
  38. package/dist/addons/plate-recognition/index.js.map +1 -1
  39. package/dist/addons/plate-recognition/index.mjs +244 -5
  40. package/dist/addons/plate-recognition/index.mjs.map +1 -1
  41. package/dist/addons/segmentation-refiner/index.js +967 -790
  42. package/dist/addons/segmentation-refiner/index.js.map +1 -1
  43. package/dist/addons/segmentation-refiner/index.mjs +21 -17
  44. package/dist/addons/segmentation-refiner/index.mjs.map +1 -1
  45. package/dist/addons/vehicle-classifier/index.js +581 -410
  46. package/dist/addons/vehicle-classifier/index.js.map +1 -1
  47. package/dist/addons/vehicle-classifier/index.mjs +20 -16
  48. package/dist/addons/vehicle-classifier/index.mjs.map +1 -1
  49. package/dist/chunk-2YMA6QOV.mjs +193 -0
  50. package/dist/chunk-2YMA6QOV.mjs.map +1 -0
  51. package/dist/chunk-3IIFBJCD.mjs +45 -0
  52. package/dist/chunk-BS4DKYGN.mjs +48 -0
  53. package/dist/{chunk-7DYHXUPZ.mjs.map → chunk-BS4DKYGN.mjs.map} +1 -1
  54. package/dist/chunk-DE7I3VHO.mjs +106 -0
  55. package/dist/{chunk-KUO2BVFY.mjs.map → chunk-DE7I3VHO.mjs.map} +1 -1
  56. package/dist/chunk-F6D2OZ36.mjs +89 -0
  57. package/dist/chunk-F6D2OZ36.mjs.map +1 -0
  58. package/dist/chunk-GAOIFQDX.mjs +59 -0
  59. package/dist/chunk-GAOIFQDX.mjs.map +1 -0
  60. package/dist/chunk-HUIX2XVR.mjs +159 -0
  61. package/dist/chunk-HUIX2XVR.mjs.map +1 -0
  62. package/dist/chunk-K36R6HWY.mjs +51 -0
  63. package/dist/{chunk-XZ6ZMXXU.mjs.map → chunk-K36R6HWY.mjs.map} +1 -1
  64. package/dist/chunk-MBTAI3WE.mjs +78 -0
  65. package/dist/chunk-MBTAI3WE.mjs.map +1 -0
  66. package/dist/chunk-MGT6RUVX.mjs +423 -0
  67. package/dist/{chunk-BP7H4NFS.mjs.map → chunk-MGT6RUVX.mjs.map} +1 -1
  68. package/dist/chunk-PIFS7AIT.mjs +446 -0
  69. package/dist/{chunk-2IOKI4ES.mjs.map → chunk-PIFS7AIT.mjs.map} +1 -1
  70. package/dist/chunk-WG66JYYW.mjs +116 -0
  71. package/dist/{chunk-22BHCDT5.mjs.map → chunk-WG66JYYW.mjs.map} +1 -1
  72. package/dist/chunk-XD7WGXHZ.mjs +82 -0
  73. package/dist/{chunk-DUN6XU3N.mjs.map → chunk-XD7WGXHZ.mjs.map} +1 -1
  74. package/dist/chunk-YYDM6V2F.mjs +113 -0
  75. package/dist/{chunk-BR2FPGOX.mjs.map → chunk-YYDM6V2F.mjs.map} +1 -1
  76. package/dist/chunk-ZK7P3TZN.mjs +286 -0
  77. package/dist/chunk-ZK7P3TZN.mjs.map +1 -0
  78. package/dist/index.js +4443 -3924
  79. package/dist/index.js.map +1 -1
  80. package/dist/index.mjs +2698 -250
  81. package/dist/index.mjs.map +1 -1
  82. package/package.json +1 -1
  83. package/dist/chunk-22BHCDT5.mjs +0 -101
  84. package/dist/chunk-2IOKI4ES.mjs +0 -335
  85. package/dist/chunk-7DYHXUPZ.mjs +0 -36
  86. package/dist/chunk-BJTO5JO5.mjs +0 -11
  87. package/dist/chunk-BP7H4NFS.mjs +0 -412
  88. package/dist/chunk-BR2FPGOX.mjs +0 -98
  89. package/dist/chunk-D6WEHN33.mjs +0 -276
  90. package/dist/chunk-D6WEHN33.mjs.map +0 -1
  91. package/dist/chunk-DRYFGARD.mjs +0 -289
  92. package/dist/chunk-DRYFGARD.mjs.map +0 -1
  93. package/dist/chunk-DUN6XU3N.mjs +0 -72
  94. package/dist/chunk-ESLHNWWE.mjs +0 -387
  95. package/dist/chunk-ESLHNWWE.mjs.map +0 -1
  96. package/dist/chunk-JUQEW6ON.mjs +0 -256
  97. package/dist/chunk-JUQEW6ON.mjs.map +0 -1
  98. package/dist/chunk-KUO2BVFY.mjs +0 -90
  99. package/dist/chunk-R5J3WAUI.mjs +0 -645
  100. package/dist/chunk-R5J3WAUI.mjs.map +0 -1
  101. package/dist/chunk-XZ6ZMXXU.mjs +0 -39
  102. package/dist/chunk-YPU4WTXZ.mjs +0 -269
  103. package/dist/chunk-YPU4WTXZ.mjs.map +0 -1
  104. package/dist/chunk-YUCD2TFH.mjs +0 -242
  105. package/dist/chunk-YUCD2TFH.mjs.map +0 -1
  106. package/dist/chunk-ZTJENCFC.mjs +0 -379
  107. package/dist/chunk-ZTJENCFC.mjs.map +0 -1
  108. package/dist/chunk-ZWYXXCXP.mjs +0 -248
  109. package/dist/chunk-ZWYXXCXP.mjs.map +0 -1
  110. /package/dist/{chunk-BJTO5JO5.mjs.map → chunk-3IIFBJCD.mjs.map} +0 -0
@@ -5,6 +5,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __commonJS = (cb, mod) => function __require() {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ };
8
11
  var __export = (target, all) => {
9
12
  for (var name in all)
10
13
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -27,401 +30,521 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
30
  ));
28
31
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
32
 
30
- // src/addons/audio-classification/index.ts
31
- var audio_classification_exports = {};
32
- __export(audio_classification_exports, {
33
- default: () => AudioClassificationAddon
34
- });
35
- module.exports = __toCommonJS(audio_classification_exports);
36
-
37
- // src/catalogs/audio-classification-models.ts
38
- var import_types = require("@camstack/types");
39
- var HF_REPO = "camstack/camstack-models";
40
- var AUDIO_LABELS = [
41
- { id: "audio", name: "Audio Event" }
42
- ];
43
- var AUDIO_CLASSIFICATION_MODELS = [
44
- {
45
- id: "yamnet",
46
- name: "YAMNet",
47
- description: "YAMNet \u2014 audio event classification from raw waveform",
48
- inputSize: { width: 1, height: 16e3 },
49
- labels: AUDIO_LABELS,
50
- formats: {
51
- onnx: {
52
- url: (0, import_types.hfModelUrl)(HF_REPO, "audioClassification/yamnet/onnx/camstack-yamnet.onnx"),
53
- sizeMB: 15
54
- },
55
- openvino: {
56
- url: (0, import_types.hfModelUrl)(HF_REPO, "audioClassification/yamnet/openvino/camstack-yamnet.xml"),
57
- sizeMB: 8
33
+ // src/catalogs/audio-classification-models.js
34
+ var require_audio_classification_models = __commonJS({
35
+ "src/catalogs/audio-classification-models.js"(exports2) {
36
+ "use strict";
37
+ Object.defineProperty(exports2, "__esModule", { value: true });
38
+ exports2.AUDIO_CLASSIFICATION_MODELS = void 0;
39
+ var types_1 = require("@camstack/types");
40
+ var HF_REPO = "camstack/camstack-models";
41
+ var AUDIO_LABELS2 = [
42
+ { id: "audio", name: "Audio Event" }
43
+ ];
44
+ exports2.AUDIO_CLASSIFICATION_MODELS = [
45
+ {
46
+ id: "yamnet",
47
+ name: "YAMNet",
48
+ description: "YAMNet \u2014 audio event classification from raw waveform",
49
+ inputSize: { width: 1, height: 16e3 },
50
+ labels: AUDIO_LABELS2,
51
+ formats: {
52
+ onnx: {
53
+ url: (0, types_1.hfModelUrl)(HF_REPO, "audioClassification/yamnet/onnx/camstack-yamnet.onnx"),
54
+ sizeMB: 15
55
+ },
56
+ openvino: {
57
+ url: (0, types_1.hfModelUrl)(HF_REPO, "audioClassification/yamnet/openvino/camstack-yamnet.xml"),
58
+ sizeMB: 8
59
+ }
60
+ }
58
61
  }
59
- }
62
+ ];
60
63
  }
61
- ];
64
+ });
62
65
 
63
- // src/shared/postprocess/yamnet.ts
64
- function yamnetPostprocess(output, numFrames, numClasses, classNames, minScore) {
65
- const avgScores = new Float32Array(numClasses);
66
- for (let f = 0; f < numFrames; f++) {
67
- for (let c = 0; c < numClasses; c++) {
68
- const prev = avgScores[c] ?? 0;
69
- avgScores[c] = prev + (output[f * numClasses + c] ?? 0);
70
- }
71
- }
72
- if (numFrames > 0) {
73
- for (let c = 0; c < numClasses; c++) {
74
- const val = avgScores[c] ?? 0;
75
- avgScores[c] = val / numFrames;
76
- }
77
- }
78
- const results = [];
79
- for (let c = 0; c < numClasses; c++) {
80
- const score = avgScores[c];
81
- if (score >= minScore) {
82
- results.push({
83
- className: classNames[c] ?? String(c),
84
- score
85
- });
66
+ // src/shared/postprocess/yamnet.js
67
+ var require_yamnet = __commonJS({
68
+ "src/shared/postprocess/yamnet.js"(exports2) {
69
+ "use strict";
70
+ Object.defineProperty(exports2, "__esModule", { value: true });
71
+ exports2.yamnetPostprocess = yamnetPostprocess2;
72
+ function yamnetPostprocess2(output, numFrames, numClasses, classNames, minScore) {
73
+ const avgScores = new Float32Array(numClasses);
74
+ for (let f = 0; f < numFrames; f++) {
75
+ for (let c = 0; c < numClasses; c++) {
76
+ const prev = avgScores[c] ?? 0;
77
+ avgScores[c] = prev + (output[f * numClasses + c] ?? 0);
78
+ }
79
+ }
80
+ if (numFrames > 0) {
81
+ for (let c = 0; c < numClasses; c++) {
82
+ const val = avgScores[c] ?? 0;
83
+ avgScores[c] = val / numFrames;
84
+ }
85
+ }
86
+ const results = [];
87
+ for (let c = 0; c < numClasses; c++) {
88
+ const score = avgScores[c];
89
+ if (score >= minScore) {
90
+ results.push({
91
+ className: classNames[c] ?? String(c),
92
+ score
93
+ });
94
+ }
95
+ }
96
+ return results.sort((a, b) => b.score - a.score);
86
97
  }
87
98
  }
88
- return results.sort((a, b) => b.score - a.score);
89
- }
90
-
91
- // src/shared/engine-resolver.ts
92
- var fs = __toESM(require("fs"));
93
- var path2 = __toESM(require("path"));
99
+ });
94
100
 
95
- // src/shared/node-engine.ts
96
- var path = __toESM(require("path"));
97
- var BACKEND_TO_PROVIDER = {
98
- cpu: "cpu",
99
- coreml: "coreml",
100
- cuda: "cuda",
101
- tensorrt: "tensorrt",
102
- dml: "dml"
103
- };
104
- var BACKEND_TO_DEVICE = {
105
- cpu: "cpu",
106
- coreml: "gpu-mps",
107
- cuda: "gpu-cuda",
108
- tensorrt: "tensorrt"
109
- };
110
- var NodeInferenceEngine = class {
111
- constructor(modelPath, backend) {
112
- this.modelPath = modelPath;
113
- this.backend = backend;
114
- this.device = BACKEND_TO_DEVICE[backend] ?? "cpu";
115
- }
116
- runtime = "onnx";
117
- device;
118
- session = null;
119
- async initialize() {
120
- const ort = await import("onnxruntime-node");
121
- const provider = BACKEND_TO_PROVIDER[this.backend] ?? "cpu";
122
- const absModelPath = path.isAbsolute(this.modelPath) ? this.modelPath : path.resolve(process.cwd(), this.modelPath);
123
- const sessionOptions = {
124
- executionProviders: [provider]
101
+ // src/shared/node-engine.js
102
+ var require_node_engine = __commonJS({
103
+ "src/shared/node-engine.js"(exports2) {
104
+ "use strict";
105
+ var __createBinding = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
106
+ if (k2 === void 0) k2 = k;
107
+ var desc = Object.getOwnPropertyDescriptor(m, k);
108
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
109
+ desc = { enumerable: true, get: function() {
110
+ return m[k];
111
+ } };
112
+ }
113
+ Object.defineProperty(o, k2, desc);
114
+ }) : (function(o, m, k, k2) {
115
+ if (k2 === void 0) k2 = k;
116
+ o[k2] = m[k];
117
+ }));
118
+ var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) {
119
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
120
+ }) : function(o, v) {
121
+ o["default"] = v;
122
+ });
123
+ var __importStar = exports2 && exports2.__importStar || /* @__PURE__ */ (function() {
124
+ var ownKeys = function(o) {
125
+ ownKeys = Object.getOwnPropertyNames || function(o2) {
126
+ var ar = [];
127
+ for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
128
+ return ar;
129
+ };
130
+ return ownKeys(o);
131
+ };
132
+ return function(mod) {
133
+ if (mod && mod.__esModule) return mod;
134
+ var result = {};
135
+ if (mod != null) {
136
+ for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
137
+ }
138
+ __setModuleDefault(result, mod);
139
+ return result;
140
+ };
141
+ })();
142
+ Object.defineProperty(exports2, "__esModule", { value: true });
143
+ exports2.NodeInferenceEngine = void 0;
144
+ var path = __importStar(require("path"));
145
+ var BACKEND_TO_PROVIDER = {
146
+ cpu: "cpu",
147
+ coreml: "coreml",
148
+ cuda: "cuda",
149
+ tensorrt: "tensorrt",
150
+ dml: "dml"
125
151
  };
126
- this.session = await ort.InferenceSession.create(absModelPath, sessionOptions);
127
- }
128
- async run(input, inputShape) {
129
- if (!this.session) {
130
- throw new Error("NodeInferenceEngine: not initialized \u2014 call initialize() first");
131
- }
132
- const ort = await import("onnxruntime-node");
133
- const sess = this.session;
134
- const inputName = sess.inputNames[0];
135
- const tensor = new ort.Tensor("float32", input, [...inputShape]);
136
- const feeds = { [inputName]: tensor };
137
- const results = await sess.run(feeds);
138
- const outputName = sess.outputNames[0];
139
- const outputTensor = results[outputName];
140
- return outputTensor.data;
141
- }
142
- async runMultiOutput(input, inputShape) {
143
- if (!this.session) {
144
- throw new Error("NodeInferenceEngine: not initialized \u2014 call initialize() first");
145
- }
146
- const ort = await import("onnxruntime-node");
147
- const sess = this.session;
148
- const inputName = sess.inputNames[0];
149
- const tensor = new ort.Tensor("float32", input, [...inputShape]);
150
- const feeds = { [inputName]: tensor };
151
- const results = await sess.run(feeds);
152
- const out = {};
153
- for (const name of sess.outputNames) {
154
- out[name] = results[name].data;
155
- }
156
- return out;
157
- }
158
- async dispose() {
159
- this.session = null;
160
- }
161
- };
162
-
163
- // src/shared/python-engine.ts
164
- var import_node_child_process = require("child_process");
165
- var PythonInferenceEngine = class {
166
- constructor(pythonPath, scriptPath, runtime, modelPath, extraArgs = []) {
167
- this.pythonPath = pythonPath;
168
- this.scriptPath = scriptPath;
169
- this.modelPath = modelPath;
170
- this.extraArgs = extraArgs;
171
- this.runtime = runtime;
172
- const runtimeDeviceMap = {
173
- onnx: "cpu",
152
+ var BACKEND_TO_DEVICE = {
153
+ cpu: "cpu",
174
154
  coreml: "gpu-mps",
175
- pytorch: "cpu",
176
- openvino: "cpu",
177
- tflite: "cpu"
155
+ cuda: "gpu-cuda",
156
+ tensorrt: "tensorrt"
157
+ };
158
+ var NodeInferenceEngine = class {
159
+ modelPath;
160
+ backend;
161
+ runtime = "onnx";
162
+ device;
163
+ session = null;
164
+ constructor(modelPath, backend) {
165
+ this.modelPath = modelPath;
166
+ this.backend = backend;
167
+ this.device = BACKEND_TO_DEVICE[backend] ?? "cpu";
168
+ }
169
+ async initialize() {
170
+ const ort = await Promise.resolve().then(() => __importStar(require("onnxruntime-node")));
171
+ const provider = BACKEND_TO_PROVIDER[this.backend] ?? "cpu";
172
+ const absModelPath = path.isAbsolute(this.modelPath) ? this.modelPath : path.resolve(process.cwd(), this.modelPath);
173
+ const sessionOptions = {
174
+ executionProviders: [provider]
175
+ };
176
+ this.session = await ort.InferenceSession.create(absModelPath, sessionOptions);
177
+ }
178
+ async run(input, inputShape) {
179
+ if (!this.session) {
180
+ throw new Error("NodeInferenceEngine: not initialized \u2014 call initialize() first");
181
+ }
182
+ const ort = await Promise.resolve().then(() => __importStar(require("onnxruntime-node")));
183
+ const sess = this.session;
184
+ const inputName = sess.inputNames[0];
185
+ const tensor = new ort.Tensor("float32", input, [...inputShape]);
186
+ const feeds = { [inputName]: tensor };
187
+ const results = await sess.run(feeds);
188
+ const outputName = sess.outputNames[0];
189
+ const outputTensor = results[outputName];
190
+ return outputTensor.data;
191
+ }
192
+ async runMultiOutput(input, inputShape) {
193
+ if (!this.session) {
194
+ throw new Error("NodeInferenceEngine: not initialized \u2014 call initialize() first");
195
+ }
196
+ const ort = await Promise.resolve().then(() => __importStar(require("onnxruntime-node")));
197
+ const sess = this.session;
198
+ const inputName = sess.inputNames[0];
199
+ const tensor = new ort.Tensor("float32", input, [...inputShape]);
200
+ const feeds = { [inputName]: tensor };
201
+ const results = await sess.run(feeds);
202
+ const out = {};
203
+ for (const name of sess.outputNames) {
204
+ out[name] = results[name].data;
205
+ }
206
+ return out;
207
+ }
208
+ async dispose() {
209
+ this.session = null;
210
+ }
178
211
  };
179
- this.device = runtimeDeviceMap[runtime];
212
+ exports2.NodeInferenceEngine = NodeInferenceEngine;
180
213
  }
181
- runtime;
182
- device;
183
- process = null;
184
- receiveBuffer = Buffer.alloc(0);
185
- pendingResolve = null;
186
- pendingReject = null;
187
- async initialize() {
188
- const args = [this.scriptPath, this.modelPath, ...this.extraArgs];
189
- this.process = (0, import_node_child_process.spawn)(this.pythonPath, args, {
190
- stdio: ["pipe", "pipe", "pipe"]
191
- });
192
- if (!this.process.stdout || !this.process.stdin) {
193
- throw new Error("PythonInferenceEngine: failed to create process pipes");
194
- }
195
- this.process.stderr?.on("data", (chunk) => {
196
- process.stderr.write(`[python-engine] ${chunk.toString()}`);
197
- });
198
- this.process.on("error", (err) => {
199
- this.pendingReject?.(err);
200
- this.pendingReject = null;
201
- this.pendingResolve = null;
202
- });
203
- this.process.on("exit", (code) => {
204
- if (code !== 0) {
205
- const err = new Error(`PythonInferenceEngine: process exited with code ${code}`);
206
- this.pendingReject?.(err);
207
- this.pendingReject = null;
214
+ });
215
+
216
+ // src/shared/python-engine.js
217
+ var require_python_engine = __commonJS({
218
+ "src/shared/python-engine.js"(exports2) {
219
+ "use strict";
220
+ Object.defineProperty(exports2, "__esModule", { value: true });
221
+ exports2.PythonInferenceEngine = void 0;
222
+ exports2.resolvePythonBinary = resolvePythonBinary;
223
+ var node_child_process_1 = require("child_process");
224
+ var PythonInferenceEngine = class {
225
+ pythonPath;
226
+ scriptPath;
227
+ modelPath;
228
+ extraArgs;
229
+ runtime;
230
+ device;
231
+ process = null;
232
+ receiveBuffer = Buffer.alloc(0);
233
+ pendingResolve = null;
234
+ pendingReject = null;
235
+ constructor(pythonPath, scriptPath, runtime, modelPath, extraArgs = []) {
236
+ this.pythonPath = pythonPath;
237
+ this.scriptPath = scriptPath;
238
+ this.modelPath = modelPath;
239
+ this.extraArgs = extraArgs;
240
+ this.runtime = runtime;
241
+ const runtimeDeviceMap = {
242
+ onnx: "cpu",
243
+ coreml: "gpu-mps",
244
+ pytorch: "cpu",
245
+ openvino: "cpu",
246
+ tflite: "cpu"
247
+ };
248
+ this.device = runtimeDeviceMap[runtime];
249
+ }
250
+ async initialize() {
251
+ const args = [this.scriptPath, this.modelPath, ...this.extraArgs];
252
+ this.process = (0, node_child_process_1.spawn)(this.pythonPath, args, {
253
+ stdio: ["pipe", "pipe", "pipe"]
254
+ });
255
+ if (!this.process.stdout || !this.process.stdin) {
256
+ throw new Error("PythonInferenceEngine: failed to create process pipes");
257
+ }
258
+ this.process.stderr?.on("data", (chunk) => {
259
+ process.stderr.write(`[python-engine] ${chunk.toString()}`);
260
+ });
261
+ this.process.on("error", (err) => {
262
+ this.pendingReject?.(err);
263
+ this.pendingReject = null;
264
+ this.pendingResolve = null;
265
+ });
266
+ this.process.on("exit", (code) => {
267
+ if (code !== 0) {
268
+ const err = new Error(`PythonInferenceEngine: process exited with code ${code}`);
269
+ this.pendingReject?.(err);
270
+ this.pendingReject = null;
271
+ this.pendingResolve = null;
272
+ }
273
+ });
274
+ this.process.stdout.on("data", (chunk) => {
275
+ this.receiveBuffer = Buffer.concat([this.receiveBuffer, chunk]);
276
+ this._tryReceive();
277
+ });
278
+ await new Promise((resolve, reject) => {
279
+ const timeout = setTimeout(() => resolve(), 2e3);
280
+ this.process?.on("error", (err) => {
281
+ clearTimeout(timeout);
282
+ reject(err);
283
+ });
284
+ this.process?.on("exit", (code) => {
285
+ clearTimeout(timeout);
286
+ if (code !== 0) {
287
+ reject(new Error(`PythonInferenceEngine: process exited early with code ${code}`));
288
+ }
289
+ });
290
+ });
291
+ }
292
+ _tryReceive() {
293
+ if (this.receiveBuffer.length < 4)
294
+ return;
295
+ const length = this.receiveBuffer.readUInt32LE(0);
296
+ if (this.receiveBuffer.length < 4 + length)
297
+ return;
298
+ const jsonBytes = this.receiveBuffer.subarray(4, 4 + length);
299
+ this.receiveBuffer = this.receiveBuffer.subarray(4 + length);
300
+ const resolve = this.pendingResolve;
301
+ const reject = this.pendingReject;
208
302
  this.pendingResolve = null;
303
+ this.pendingReject = null;
304
+ if (!resolve)
305
+ return;
306
+ try {
307
+ const parsed = JSON.parse(jsonBytes.toString("utf8"));
308
+ resolve(parsed);
309
+ } catch (err) {
310
+ reject?.(err instanceof Error ? err : new Error(String(err)));
311
+ }
209
312
  }
210
- });
211
- this.process.stdout.on("data", (chunk) => {
212
- this.receiveBuffer = Buffer.concat([this.receiveBuffer, chunk]);
213
- this._tryReceive();
214
- });
215
- await new Promise((resolve2, reject) => {
216
- const timeout = setTimeout(() => resolve2(), 2e3);
217
- this.process?.on("error", (err) => {
218
- clearTimeout(timeout);
219
- reject(err);
220
- });
221
- this.process?.on("exit", (code) => {
222
- clearTimeout(timeout);
223
- if (code !== 0) {
224
- reject(new Error(`PythonInferenceEngine: process exited early with code ${code}`));
313
+ /** Send JPEG buffer, receive JSON detection results */
314
+ async runJpeg(jpeg) {
315
+ if (!this.process?.stdin) {
316
+ throw new Error("PythonInferenceEngine: process not initialized");
225
317
  }
226
- });
227
- });
228
- }
229
- _tryReceive() {
230
- if (this.receiveBuffer.length < 4) return;
231
- const length = this.receiveBuffer.readUInt32LE(0);
232
- if (this.receiveBuffer.length < 4 + length) return;
233
- const jsonBytes = this.receiveBuffer.subarray(4, 4 + length);
234
- this.receiveBuffer = this.receiveBuffer.subarray(4 + length);
235
- const resolve2 = this.pendingResolve;
236
- const reject = this.pendingReject;
237
- this.pendingResolve = null;
238
- this.pendingReject = null;
239
- if (!resolve2) return;
240
- try {
241
- const parsed = JSON.parse(jsonBytes.toString("utf8"));
242
- resolve2(parsed);
243
- } catch (err) {
244
- reject?.(err instanceof Error ? err : new Error(String(err)));
245
- }
246
- }
247
- /** Send JPEG buffer, receive JSON detection results */
248
- async runJpeg(jpeg) {
249
- if (!this.process?.stdin) {
250
- throw new Error("PythonInferenceEngine: process not initialized");
251
- }
252
- return new Promise((resolve2, reject) => {
253
- this.pendingResolve = resolve2;
254
- this.pendingReject = reject;
255
- const lengthBuf = Buffer.allocUnsafe(4);
256
- lengthBuf.writeUInt32LE(jpeg.length, 0);
257
- this.process.stdin.write(Buffer.concat([lengthBuf, jpeg]));
258
- });
259
- }
260
- /** IInferenceEngine.run — wraps runJpeg for compatibility */
261
- async run(_input, _inputShape) {
262
- throw new Error(
263
- "PythonInferenceEngine: use runJpeg() directly \u2014 this engine operates on JPEG input"
264
- );
265
- }
266
- /** IInferenceEngine.runMultiOutput — not supported by Python engine (operates on JPEG input) */
267
- async runMultiOutput(_input, _inputShape) {
268
- throw new Error(
269
- "PythonInferenceEngine: runMultiOutput() is not supported \u2014 this engine operates on JPEG input"
270
- );
271
- }
272
- async dispose() {
273
- if (this.process) {
274
- this.process.stdin?.end();
275
- this.process.kill("SIGTERM");
276
- this.process = null;
318
+ return new Promise((resolve, reject) => {
319
+ this.pendingResolve = resolve;
320
+ this.pendingReject = reject;
321
+ const lengthBuf = Buffer.allocUnsafe(4);
322
+ lengthBuf.writeUInt32LE(jpeg.length, 0);
323
+ this.process.stdin.write(Buffer.concat([lengthBuf, jpeg]));
324
+ });
325
+ }
326
+ /** IInferenceEngine.run wraps runJpeg for compatibility */
327
+ async run(_input, _inputShape) {
328
+ throw new Error("PythonInferenceEngine: use runJpeg() directly \u2014 this engine operates on JPEG input");
329
+ }
330
+ /** IInferenceEngine.runMultiOutput not supported by Python engine (operates on JPEG input) */
331
+ async runMultiOutput(_input, _inputShape) {
332
+ throw new Error("PythonInferenceEngine: runMultiOutput() is not supported \u2014 this engine operates on JPEG input");
333
+ }
334
+ async dispose() {
335
+ if (this.process) {
336
+ this.process.stdin?.end();
337
+ this.process.kill("SIGTERM");
338
+ this.process = null;
339
+ }
340
+ }
341
+ };
342
+ exports2.PythonInferenceEngine = PythonInferenceEngine;
343
+ async function resolvePythonBinary(configPath, deps) {
344
+ if (configPath)
345
+ return configPath;
346
+ return deps.ensurePython();
277
347
  }
278
348
  }
279
- };
349
+ });
280
350
 
281
- // src/shared/engine-resolver.ts
282
- var AUTO_BACKEND_PRIORITY = ["coreml", "cuda", "tensorrt", "cpu"];
283
- var BACKEND_TO_FORMAT = {
284
- cpu: "onnx",
285
- coreml: "onnx",
286
- cuda: "onnx",
287
- tensorrt: "onnx"
288
- };
289
- var RUNTIME_TO_FORMAT = {
290
- onnx: "onnx",
291
- coreml: "coreml",
292
- openvino: "openvino",
293
- tflite: "tflite",
294
- pytorch: "pt"
295
- };
296
- function modelFilePath(modelsDir, modelEntry, format) {
297
- const formatEntry = modelEntry.formats[format];
298
- if (!formatEntry) {
299
- throw new Error(`Model ${modelEntry.id} has no ${format} format`);
300
- }
301
- const urlParts = formatEntry.url.split("/");
302
- const filename = urlParts[urlParts.length - 1] ?? `${modelEntry.id}.${format}`;
303
- return path2.join(modelsDir, filename);
304
- }
305
- function modelExists(filePath) {
306
- try {
307
- return fs.existsSync(filePath);
308
- } catch {
309
- return false;
310
- }
311
- }
312
- async function resolveEngine(options) {
313
- const { runtime, backend, modelEntry, modelsDir, models } = options;
314
- let selectedFormat;
315
- let selectedBackend;
316
- if (runtime === "auto") {
317
- const available = await probeOnnxBackends();
318
- let chosen = null;
319
- for (const b of AUTO_BACKEND_PRIORITY) {
320
- if (!available.includes(b)) continue;
321
- const fmt = BACKEND_TO_FORMAT[b];
322
- if (!fmt) continue;
323
- if (!modelEntry.formats[fmt]) continue;
324
- chosen = { backend: b, format: fmt };
325
- break;
326
- }
327
- if (!chosen) {
328
- throw new Error(
329
- `resolveEngine: no compatible backend found for model ${modelEntry.id}. Available backends: ${available.join(", ")}`
330
- );
331
- }
332
- selectedFormat = chosen.format;
333
- selectedBackend = chosen.backend;
334
- } else {
335
- const fmt = RUNTIME_TO_FORMAT[runtime];
336
- if (!fmt) {
337
- throw new Error(`resolveEngine: unsupported runtime "${runtime}"`);
338
- }
339
- if (!modelEntry.formats[fmt]) {
340
- throw new Error(
341
- `resolveEngine: model ${modelEntry.id} has no ${fmt} format for runtime ${runtime}`
342
- );
351
+ // src/shared/engine-resolver.js
352
+ var require_engine_resolver = __commonJS({
353
+ "src/shared/engine-resolver.js"(exports2) {
354
+ "use strict";
355
+ var __createBinding = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
356
+ if (k2 === void 0) k2 = k;
357
+ var desc = Object.getOwnPropertyDescriptor(m, k);
358
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
359
+ desc = { enumerable: true, get: function() {
360
+ return m[k];
361
+ } };
362
+ }
363
+ Object.defineProperty(o, k2, desc);
364
+ }) : (function(o, m, k, k2) {
365
+ if (k2 === void 0) k2 = k;
366
+ o[k2] = m[k];
367
+ }));
368
+ var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) {
369
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
370
+ }) : function(o, v) {
371
+ o["default"] = v;
372
+ });
373
+ var __importStar = exports2 && exports2.__importStar || /* @__PURE__ */ (function() {
374
+ var ownKeys = function(o) {
375
+ ownKeys = Object.getOwnPropertyNames || function(o2) {
376
+ var ar = [];
377
+ for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
378
+ return ar;
379
+ };
380
+ return ownKeys(o);
381
+ };
382
+ return function(mod) {
383
+ if (mod && mod.__esModule) return mod;
384
+ var result = {};
385
+ if (mod != null) {
386
+ for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
387
+ }
388
+ __setModuleDefault(result, mod);
389
+ return result;
390
+ };
391
+ })();
392
+ Object.defineProperty(exports2, "__esModule", { value: true });
393
+ exports2.resolveEngine = resolveEngine2;
394
+ exports2.probeOnnxBackends = probeOnnxBackends;
395
+ var fs = __importStar(require("fs"));
396
+ var path = __importStar(require("path"));
397
+ var node_engine_js_1 = require_node_engine();
398
+ var python_engine_js_1 = require_python_engine();
399
+ var AUTO_BACKEND_PRIORITY = ["coreml", "cuda", "tensorrt", "cpu"];
400
+ var BACKEND_TO_FORMAT = {
401
+ cpu: "onnx",
402
+ coreml: "onnx",
403
+ cuda: "onnx",
404
+ tensorrt: "onnx"
405
+ };
406
+ var RUNTIME_TO_FORMAT = {
407
+ onnx: "onnx",
408
+ coreml: "coreml",
409
+ openvino: "openvino",
410
+ tflite: "tflite",
411
+ pytorch: "pt"
412
+ };
413
+ function modelFilePath(modelsDir, modelEntry, format) {
414
+ const formatEntry = modelEntry.formats[format];
415
+ if (!formatEntry) {
416
+ throw new Error(`Model ${modelEntry.id} has no ${format} format`);
417
+ }
418
+ const urlParts = formatEntry.url.split("/");
419
+ const filename = urlParts[urlParts.length - 1] ?? `${modelEntry.id}.${format}`;
420
+ return path.join(modelsDir, filename);
343
421
  }
344
- selectedFormat = fmt;
345
- selectedBackend = runtime === "onnx" ? backend || "cpu" : runtime;
346
- }
347
- let modelPath;
348
- if (models) {
349
- modelPath = await models.ensure(modelEntry.id, selectedFormat);
350
- } else {
351
- modelPath = modelFilePath(modelsDir, modelEntry, selectedFormat);
352
- if (!modelExists(modelPath)) {
353
- throw new Error(
354
- `resolveEngine: model file not found at ${modelPath} and no model service provided`
355
- );
422
+ function modelExists(filePath) {
423
+ try {
424
+ return fs.existsSync(filePath);
425
+ } catch {
426
+ return false;
427
+ }
356
428
  }
357
- }
358
- if (selectedFormat === "onnx") {
359
- const engine = new NodeInferenceEngine(modelPath, selectedBackend);
360
- await engine.initialize();
361
- return { engine, format: selectedFormat, modelPath };
362
- }
363
- const { pythonPath } = options;
364
- const PYTHON_SCRIPT_MAP = {
365
- coreml: "coreml_inference.py",
366
- pytorch: "pytorch_inference.py",
367
- openvino: "openvino_inference.py"
368
- };
369
- const effectiveRuntime = runtime === "auto" ? selectedBackend : runtime;
370
- const scriptName = PYTHON_SCRIPT_MAP[effectiveRuntime];
371
- if (scriptName && pythonPath) {
372
- const candidates = [
373
- path2.join(__dirname, "../../python", scriptName),
374
- path2.join(__dirname, "../python", scriptName),
375
- path2.join(__dirname, "../../../python", scriptName)
376
- ];
377
- const scriptPath = candidates.find((p) => fs.existsSync(p));
378
- if (!scriptPath) {
379
- throw new Error(
380
- `resolveEngine: Python script "${scriptName}" not found. Searched:
381
- ${candidates.join("\n")}`
382
- );
429
+ async function resolveEngine2(options) {
430
+ const { runtime, backend, modelEntry, modelsDir, models } = options;
431
+ let selectedFormat;
432
+ let selectedBackend;
433
+ if (runtime === "auto") {
434
+ const available = await probeOnnxBackends();
435
+ let chosen = null;
436
+ for (const b of AUTO_BACKEND_PRIORITY) {
437
+ if (!available.includes(b))
438
+ continue;
439
+ const fmt = BACKEND_TO_FORMAT[b];
440
+ if (!fmt)
441
+ continue;
442
+ if (!modelEntry.formats[fmt])
443
+ continue;
444
+ chosen = { backend: b, format: fmt };
445
+ break;
446
+ }
447
+ if (!chosen) {
448
+ throw new Error(`resolveEngine: no compatible backend found for model ${modelEntry.id}. Available backends: ${available.join(", ")}`);
449
+ }
450
+ selectedFormat = chosen.format;
451
+ selectedBackend = chosen.backend;
452
+ } else {
453
+ const fmt = RUNTIME_TO_FORMAT[runtime];
454
+ if (!fmt) {
455
+ throw new Error(`resolveEngine: unsupported runtime "${runtime}"`);
456
+ }
457
+ if (!modelEntry.formats[fmt]) {
458
+ throw new Error(`resolveEngine: model ${modelEntry.id} has no ${fmt} format for runtime ${runtime}`);
459
+ }
460
+ selectedFormat = fmt;
461
+ selectedBackend = runtime === "onnx" ? backend || "cpu" : runtime;
462
+ }
463
+ let modelPath;
464
+ if (models) {
465
+ modelPath = await models.ensure(modelEntry.id, selectedFormat);
466
+ } else {
467
+ modelPath = modelFilePath(modelsDir, modelEntry, selectedFormat);
468
+ if (!modelExists(modelPath)) {
469
+ throw new Error(`resolveEngine: model file not found at ${modelPath} and no model service provided`);
470
+ }
471
+ }
472
+ if (selectedFormat === "onnx") {
473
+ const engine = new node_engine_js_1.NodeInferenceEngine(modelPath, selectedBackend);
474
+ await engine.initialize();
475
+ return { engine, format: selectedFormat, modelPath };
476
+ }
477
+ const { pythonPath } = options;
478
+ const PYTHON_SCRIPT_MAP = {
479
+ coreml: "coreml_inference.py",
480
+ pytorch: "pytorch_inference.py",
481
+ openvino: "openvino_inference.py"
482
+ };
483
+ const effectiveRuntime = runtime === "auto" ? selectedBackend : runtime;
484
+ const scriptName = PYTHON_SCRIPT_MAP[effectiveRuntime];
485
+ if (scriptName && pythonPath) {
486
+ const candidates = [
487
+ path.join(__dirname, "../../python", scriptName),
488
+ path.join(__dirname, "../python", scriptName),
489
+ path.join(__dirname, "../../../python", scriptName)
490
+ ];
491
+ const scriptPath = candidates.find((p) => fs.existsSync(p));
492
+ if (!scriptPath) {
493
+ throw new Error(`resolveEngine: Python script "${scriptName}" not found. Searched:
494
+ ${candidates.join("\n")}`);
495
+ }
496
+ const inputSize = Math.max(modelEntry.inputSize.width, modelEntry.inputSize.height);
497
+ const engine = new python_engine_js_1.PythonInferenceEngine(pythonPath, scriptPath, effectiveRuntime, modelPath, [
498
+ `--input-size=${inputSize}`,
499
+ `--confidence=0.25`
500
+ ]);
501
+ await engine.initialize();
502
+ return { engine, format: selectedFormat, modelPath };
503
+ }
504
+ const fallbackPath = modelFilePath(modelsDir, modelEntry, "onnx");
505
+ if (modelEntry.formats["onnx"] && modelExists(fallbackPath)) {
506
+ const engine = new node_engine_js_1.NodeInferenceEngine(fallbackPath, "cpu");
507
+ await engine.initialize();
508
+ return { engine, format: "onnx", modelPath: fallbackPath };
509
+ }
510
+ throw new Error(`resolveEngine: format ${selectedFormat} is not yet supported by NodeInferenceEngine, no Python runtime is available, and no ONNX fallback exists`);
383
511
  }
384
- const inputSize = Math.max(modelEntry.inputSize.width, modelEntry.inputSize.height);
385
- const engine = new PythonInferenceEngine(pythonPath, scriptPath, effectiveRuntime, modelPath, [
386
- `--input-size=${inputSize}`,
387
- `--confidence=0.25`
388
- ]);
389
- await engine.initialize();
390
- return { engine, format: selectedFormat, modelPath };
391
- }
392
- const fallbackPath = modelFilePath(modelsDir, modelEntry, "onnx");
393
- if (modelEntry.formats["onnx"] && modelExists(fallbackPath)) {
394
- const engine = new NodeInferenceEngine(fallbackPath, "cpu");
395
- await engine.initialize();
396
- return { engine, format: "onnx", modelPath: fallbackPath };
397
- }
398
- throw new Error(
399
- `resolveEngine: format ${selectedFormat} is not yet supported by NodeInferenceEngine, no Python runtime is available, and no ONNX fallback exists`
400
- );
401
- }
402
- async function probeOnnxBackends() {
403
- const available = ["cpu"];
404
- try {
405
- const ort = await import("onnxruntime-node");
406
- const providers = ort.env?.webgl?.disabled !== void 0 ? ort.InferenceSession?.getAvailableProviders?.() ?? [] : [];
407
- for (const p of providers) {
408
- const normalized = p.toLowerCase().replace("executionprovider", "");
409
- if (normalized === "coreml") available.push("coreml");
410
- else if (normalized === "cuda") available.push("cuda");
411
- else if (normalized === "tensorrt") available.push("tensorrt");
512
+ async function probeOnnxBackends() {
513
+ const available = ["cpu"];
514
+ try {
515
+ const ort = await Promise.resolve().then(() => __importStar(require("onnxruntime-node")));
516
+ const providers = ort.env?.webgl?.disabled !== void 0 ? ort.InferenceSession?.getAvailableProviders?.() ?? [] : [];
517
+ for (const p of providers) {
518
+ const normalized = p.toLowerCase().replace("executionprovider", "");
519
+ if (normalized === "coreml")
520
+ available.push("coreml");
521
+ else if (normalized === "cuda")
522
+ available.push("cuda");
523
+ else if (normalized === "tensorrt")
524
+ available.push("tensorrt");
525
+ }
526
+ } catch {
527
+ }
528
+ if (process.platform === "darwin" && !available.includes("coreml")) {
529
+ available.push("coreml");
530
+ }
531
+ return [...new Set(available)];
412
532
  }
413
- } catch {
414
533
  }
415
- if (process.platform === "darwin" && !available.includes("coreml")) {
416
- available.push("coreml");
417
- }
418
- return [...new Set(available)];
419
- }
534
+ });
420
535
 
421
536
  // src/addons/audio-classification/index.ts
537
+ var audio_classification_exports = {};
538
+ __export(audio_classification_exports, {
539
+ default: () => AudioClassificationAddon
540
+ });
541
+ module.exports = __toCommonJS(audio_classification_exports);
542
+ var import_audio_classification_models = __toESM(require_audio_classification_models());
543
+ var import_yamnet = __toESM(require_yamnet());
544
+ var import_engine_resolver = __toESM(require_engine_resolver());
422
545
  var YAMNET_NUM_CLASSES = 521;
423
546
  var AUDIO_EVENT_LABEL = { id: "audio-event", name: "Audio Event" };
424
- var AUDIO_LABELS2 = [AUDIO_EVENT_LABEL];
547
+ var AUDIO_LABELS = [AUDIO_EVENT_LABEL];
425
548
  var AUDIO_CLASS_MAP = { mapping: {}, preserveOriginal: true };
426
549
  var AudioClassificationAddon = class {
427
550
  id = "audio-classification";
@@ -453,7 +576,7 @@ var AudioClassificationAddon = class {
453
576
  resolvedConfig = null;
454
577
  ctx = null;
455
578
  getModelRequirements() {
456
- return AUDIO_CLASSIFICATION_MODELS.map((m) => ({
579
+ return import_audio_classification_models.AUDIO_CLASSIFICATION_MODELS.map((m) => ({
457
580
  modelId: m.id,
458
581
  name: m.name,
459
582
  minRAM_MB: 100,
@@ -469,7 +592,7 @@ var AudioClassificationAddon = class {
469
592
  const cfg = ctx.addonConfig;
470
593
  const modelId = cfg["modelId"] ?? this.resolvedConfig?.modelId ?? "yamnet";
471
594
  this.minScore = cfg["minScore"] ?? 0.3;
472
- const entry = AUDIO_CLASSIFICATION_MODELS.find((m) => m.id === modelId);
595
+ const entry = import_audio_classification_models.AUDIO_CLASSIFICATION_MODELS.find((m) => m.id === modelId);
473
596
  if (!entry) {
474
597
  throw new Error(`AudioClassificationAddon: unknown modelId "${modelId}"`);
475
598
  }
@@ -497,7 +620,7 @@ var AudioClassificationAddon = class {
497
620
  while (classNames.length < YAMNET_NUM_CLASSES) {
498
621
  classNames.push(`class_${classNames.length}`);
499
622
  }
500
- const results = yamnetPostprocess(
623
+ const results = (0, import_yamnet.yamnetPostprocess)(
501
624
  output,
502
625
  Math.round(numFrames),
503
626
  YAMNET_NUM_CLASSES,
@@ -520,13 +643,13 @@ var AudioClassificationAddon = class {
520
643
  const runtime = config?.runtime === "python" ? "coreml" : config?.runtime === "node" ? "onnx" : "auto";
521
644
  const backend = config?.backend ?? "cpu";
522
645
  const format = config?.format ?? "onnx";
523
- const entry = AUDIO_CLASSIFICATION_MODELS.find((m) => m.id === modelId) ?? this.modelEntry;
646
+ const entry = import_audio_classification_models.AUDIO_CLASSIFICATION_MODELS.find((m) => m.id === modelId) ?? this.modelEntry;
524
647
  this.modelEntry = entry;
525
648
  const modelsDir = this.ctx.models?.getModelsDir() ?? this.ctx.locationPaths.models;
526
649
  if (this.ctx.models) {
527
650
  await this.ctx.models.ensure(modelId, format);
528
651
  }
529
- const resolved = await resolveEngine({
652
+ const resolved = await (0, import_engine_resolver.resolveEngine)({
530
653
  runtime,
531
654
  backend,
532
655
  modelEntry: entry,
@@ -550,7 +673,7 @@ var AudioClassificationAddon = class {
550
673
  key: "modelId",
551
674
  label: "Model",
552
675
  type: "model-selector",
553
- catalog: [...AUDIO_CLASSIFICATION_MODELS],
676
+ catalog: [...import_audio_classification_models.AUDIO_CLASSIFICATION_MODELS],
554
677
  allowCustom: false,
555
678
  allowConversion: false,
556
679
  acceptFormats: ["onnx", "openvino"],
@@ -612,13 +735,13 @@ var AudioClassificationAddon = class {
612
735
  return AUDIO_CLASS_MAP;
613
736
  }
614
737
  getModelCatalog() {
615
- return [...AUDIO_CLASSIFICATION_MODELS];
738
+ return [...import_audio_classification_models.AUDIO_CLASSIFICATION_MODELS];
616
739
  }
617
740
  getAvailableModels() {
618
741
  return [];
619
742
  }
620
743
  getActiveLabels() {
621
- return AUDIO_LABELS2;
744
+ return AUDIO_LABELS;
622
745
  }
623
746
  async probe() {
624
747
  return {