@camstack/addon-vision 0.1.1 → 0.1.2

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 (58) hide show
  1. package/dist/addons/animal-classifier/index.js +0 -1
  2. package/dist/addons/animal-classifier/index.js.map +1 -1
  3. package/dist/addons/animal-classifier/index.mjs +2 -2
  4. package/dist/addons/audio-classification/index.js +0 -1
  5. package/dist/addons/audio-classification/index.js.map +1 -1
  6. package/dist/addons/audio-classification/index.mjs +2 -2
  7. package/dist/addons/bird-global-classifier/index.js +0 -1
  8. package/dist/addons/bird-global-classifier/index.js.map +1 -1
  9. package/dist/addons/bird-global-classifier/index.mjs +2 -2
  10. package/dist/addons/bird-nabirds-classifier/index.js +0 -1
  11. package/dist/addons/bird-nabirds-classifier/index.js.map +1 -1
  12. package/dist/addons/bird-nabirds-classifier/index.mjs +2 -2
  13. package/dist/addons/face-detection/index.js +0 -1
  14. package/dist/addons/face-detection/index.js.map +1 -1
  15. package/dist/addons/face-detection/index.mjs +2 -2
  16. package/dist/addons/face-recognition/index.js +0 -1
  17. package/dist/addons/face-recognition/index.js.map +1 -1
  18. package/dist/addons/face-recognition/index.mjs +2 -2
  19. package/dist/addons/object-detection/index.js +0 -1
  20. package/dist/addons/object-detection/index.js.map +1 -1
  21. package/dist/addons/object-detection/index.mjs +2 -2
  22. package/dist/addons/plate-detection/index.js +0 -1
  23. package/dist/addons/plate-detection/index.js.map +1 -1
  24. package/dist/addons/plate-detection/index.mjs +2 -2
  25. package/dist/addons/plate-recognition/index.js +0 -1
  26. package/dist/addons/plate-recognition/index.js.map +1 -1
  27. package/dist/addons/plate-recognition/index.mjs +2 -2
  28. package/dist/addons/segmentation-refiner/index.js +0 -1
  29. package/dist/addons/segmentation-refiner/index.js.map +1 -1
  30. package/dist/addons/segmentation-refiner/index.mjs +1 -1
  31. package/dist/addons/vehicle-classifier/index.js +0 -1
  32. package/dist/addons/vehicle-classifier/index.js.map +1 -1
  33. package/dist/addons/vehicle-classifier/index.mjs +1 -1
  34. package/dist/{chunk-6DJZZR64.mjs → chunk-2IOKI4ES.mjs} +1 -2
  35. package/dist/chunk-2IOKI4ES.mjs.map +1 -0
  36. package/dist/{chunk-H7LMBTS5.mjs → chunk-D6WEHN33.mjs} +2 -2
  37. package/dist/{chunk-GR65KM6X.mjs → chunk-DRYFGARD.mjs} +2 -2
  38. package/dist/{chunk-EPNWLSCG.mjs → chunk-ESLHNWWE.mjs} +2 -2
  39. package/dist/{chunk-DNQNGDR4.mjs → chunk-JUQEW6ON.mjs} +2 -2
  40. package/dist/{chunk-G32RCIUI.mjs → chunk-R5J3WAUI.mjs} +2 -2
  41. package/dist/{chunk-J6VNIIYX.mjs → chunk-YPU4WTXZ.mjs} +2 -2
  42. package/dist/{chunk-IK4XIQPC.mjs → chunk-YUCD2TFH.mjs} +2 -2
  43. package/dist/{chunk-WUMV524J.mjs → chunk-ZTJENCFC.mjs} +2 -2
  44. package/dist/{chunk-ML2JX43J.mjs → chunk-ZWYXXCXP.mjs} +2 -2
  45. package/dist/index.js +0 -1
  46. package/dist/index.js.map +1 -1
  47. package/dist/index.mjs +10 -10
  48. package/package.json +2 -3
  49. package/dist/chunk-6DJZZR64.mjs.map +0 -1
  50. /package/dist/{chunk-H7LMBTS5.mjs.map → chunk-D6WEHN33.mjs.map} +0 -0
  51. /package/dist/{chunk-GR65KM6X.mjs.map → chunk-DRYFGARD.mjs.map} +0 -0
  52. /package/dist/{chunk-EPNWLSCG.mjs.map → chunk-ESLHNWWE.mjs.map} +0 -0
  53. /package/dist/{chunk-DNQNGDR4.mjs.map → chunk-JUQEW6ON.mjs.map} +0 -0
  54. /package/dist/{chunk-G32RCIUI.mjs.map → chunk-R5J3WAUI.mjs.map} +0 -0
  55. /package/dist/{chunk-J6VNIIYX.mjs.map → chunk-YPU4WTXZ.mjs.map} +0 -0
  56. /package/dist/{chunk-IK4XIQPC.mjs.map → chunk-YUCD2TFH.mjs.map} +0 -0
  57. /package/dist/{chunk-WUMV524J.mjs.map → chunk-ZTJENCFC.mjs.map} +0 -0
  58. /package/dist/{chunk-ML2JX43J.mjs.map → chunk-ZWYXXCXP.mjs.map} +0 -0
@@ -7,7 +7,7 @@ import {
7
7
  } from "../../chunk-22BHCDT5.mjs";
8
8
  import {
9
9
  resolveEngine
10
- } from "../../chunk-6DJZZR64.mjs";
10
+ } from "../../chunk-2IOKI4ES.mjs";
11
11
  import "../../chunk-BJTO5JO5.mjs";
12
12
 
13
13
  // src/addons/vehicle-classifier/index.ts
@@ -68,7 +68,6 @@ var NodeInferenceEngine = class {
68
68
 
69
69
  // src/shared/python-engine.ts
70
70
  import { spawn } from "child_process";
71
- import { ensurePython } from "@camstack/core";
72
71
  var PythonInferenceEngine = class {
73
72
  constructor(pythonPath, scriptPath, runtime, modelPath, extraArgs = []) {
74
73
  this.pythonPath = pythonPath;
@@ -333,4 +332,4 @@ export {
333
332
  resolveEngine,
334
333
  probeOnnxBackends
335
334
  };
336
- //# sourceMappingURL=chunk-6DJZZR64.mjs.map
335
+ //# sourceMappingURL=chunk-2IOKI4ES.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/shared/node-engine.ts","../src/shared/python-engine.ts","../src/shared/engine-resolver.ts"],"sourcesContent":["import type { IInferenceEngine, DetectionRuntime, DetectionDevice } from '@camstack/types'\nimport * as path from 'node:path'\n\nconst BACKEND_TO_PROVIDER: Readonly<Record<string, string>> = {\n cpu: 'cpu',\n coreml: 'coreml',\n cuda: 'cuda',\n tensorrt: 'tensorrt',\n dml: 'dml',\n} as const\n\nconst BACKEND_TO_DEVICE: Readonly<Record<string, DetectionDevice>> = {\n cpu: 'cpu',\n coreml: 'gpu-mps',\n cuda: 'gpu-cuda',\n tensorrt: 'tensorrt',\n} as const\n\nexport class NodeInferenceEngine implements IInferenceEngine {\n readonly runtime: DetectionRuntime = 'onnx'\n readonly device: DetectionDevice\n private session: unknown = null\n\n constructor(\n private readonly modelPath: string,\n private readonly backend: string,\n ) {\n this.device = (BACKEND_TO_DEVICE[backend] ?? 'cpu') as DetectionDevice\n }\n\n async initialize(): Promise<void> {\n const ort = await import('onnxruntime-node')\n const provider = BACKEND_TO_PROVIDER[this.backend] ?? 'cpu'\n\n // Resolve absolute path\n const absModelPath = path.isAbsolute(this.modelPath)\n ? this.modelPath\n : path.resolve(process.cwd(), this.modelPath)\n\n const sessionOptions: Record<string, unknown> = {\n executionProviders: [provider],\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this.session = await (ort as any).InferenceSession.create(absModelPath, sessionOptions)\n }\n\n async run(input: Float32Array, inputShape: readonly number[]): Promise<Float32Array> {\n if (!this.session) {\n throw new Error('NodeInferenceEngine: not initialized — call initialize() first')\n }\n\n const ort = await import('onnxruntime-node')\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const sess = this.session as any\n\n // Get the first input name\n const inputName: string = sess.inputNames[0]\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const tensor = new (ort as any).Tensor('float32', input, [...inputShape])\n const feeds: Record<string, unknown> = { [inputName]: tensor }\n\n const results = await sess.run(feeds)\n const outputName: string = sess.outputNames[0]\n const outputTensor = results[outputName]\n\n return outputTensor.data as Float32Array\n }\n\n async runMultiOutput(\n input: Float32Array,\n inputShape: readonly number[],\n ): Promise<Record<string, Float32Array>> {\n if (!this.session) {\n throw new Error('NodeInferenceEngine: not initialized — call initialize() first')\n }\n\n const ort = await import('onnxruntime-node')\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const sess = this.session as any\n\n const inputName: string = sess.inputNames[0]\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const tensor = new (ort as any).Tensor('float32', input, [...inputShape])\n const feeds: Record<string, unknown> = { [inputName]: tensor }\n\n const results = await sess.run(feeds)\n\n const out: Record<string, Float32Array> = {}\n for (const name of sess.outputNames as string[]) {\n out[name] = results[name].data as Float32Array\n }\n return out\n }\n\n async dispose(): Promise<void> {\n // onnxruntime-node sessions don't have explicit close in all versions\n // but we clear the reference\n this.session = null\n }\n}\n","import type { IInferenceEngine, DetectionRuntime, DetectionDevice, IAddonDepsManager } from '@camstack/types'\nimport { spawn, type ChildProcess } from 'node:child_process'\n\nexport class PythonInferenceEngine implements IInferenceEngine {\n readonly runtime: DetectionRuntime\n readonly device: DetectionDevice\n private process: ChildProcess | null = null\n private receiveBuffer: Buffer = Buffer.alloc(0)\n private pendingResolve: ((value: Record<string, unknown>) => void) | null = null\n private pendingReject: ((reason: Error) => void) | null = null\n\n constructor(\n private readonly pythonPath: string,\n private readonly scriptPath: string,\n runtime: DetectionRuntime,\n private readonly modelPath: string,\n private readonly extraArgs: readonly string[] = [],\n ) {\n this.runtime = runtime\n // Determine device from runtime\n const runtimeDeviceMap: Readonly<Record<DetectionRuntime, DetectionDevice>> = {\n onnx: 'cpu',\n coreml: 'gpu-mps',\n pytorch: 'cpu',\n openvino: 'cpu',\n tflite: 'cpu',\n }\n this.device = runtimeDeviceMap[runtime]\n }\n\n async initialize(): Promise<void> {\n const args = [this.scriptPath, this.modelPath, ...this.extraArgs]\n this.process = spawn(this.pythonPath, args, {\n stdio: ['pipe', 'pipe', 'pipe'],\n })\n\n if (!this.process.stdout || !this.process.stdin) {\n throw new Error('PythonInferenceEngine: failed to create process pipes')\n }\n\n this.process.stderr?.on('data', (chunk: Buffer) => {\n // Log stderr from python process for debugging\n process.stderr.write(`[python-engine] ${chunk.toString()}`)\n })\n\n this.process.on('error', (err) => {\n this.pendingReject?.(err)\n this.pendingReject = null\n this.pendingResolve = null\n })\n\n this.process.on('exit', (code) => {\n if (code !== 0) {\n const err = new Error(`PythonInferenceEngine: process exited with code ${code}`)\n this.pendingReject?.(err)\n this.pendingReject = null\n this.pendingResolve = null\n }\n })\n\n this.process.stdout.on('data', (chunk: Buffer) => {\n this.receiveBuffer = Buffer.concat([this.receiveBuffer, chunk])\n this._tryReceive()\n })\n\n // Give the process a moment to start up and load the model\n await new Promise<void>((resolve, reject) => {\n const timeout = setTimeout(() => resolve(), 2000)\n this.process?.on('error', (err) => {\n clearTimeout(timeout)\n reject(err)\n })\n this.process?.on('exit', (code) => {\n clearTimeout(timeout)\n if (code !== 0) {\n reject(new Error(`PythonInferenceEngine: process exited early with code ${code}`))\n }\n })\n })\n }\n\n private _tryReceive(): void {\n // Binary IPC: [4 bytes LE uint32 length][JSON bytes]\n if (this.receiveBuffer.length < 4) return\n\n const length = this.receiveBuffer.readUInt32LE(0)\n if (this.receiveBuffer.length < 4 + length) return\n\n const jsonBytes = this.receiveBuffer.subarray(4, 4 + length)\n this.receiveBuffer = this.receiveBuffer.subarray(4 + length)\n\n const resolve = this.pendingResolve\n const reject = this.pendingReject\n this.pendingResolve = null\n this.pendingReject = null\n\n if (!resolve) return\n\n try {\n const parsed = JSON.parse(jsonBytes.toString('utf8')) as Record<string, unknown>\n resolve(parsed)\n } catch (err) {\n reject?.(err instanceof Error ? err : new Error(String(err)))\n }\n }\n\n /** Send JPEG buffer, receive JSON detection results */\n async runJpeg(jpeg: Buffer): Promise<Record<string, unknown>> {\n if (!this.process?.stdin) {\n throw new Error('PythonInferenceEngine: process not initialized')\n }\n\n return new Promise<Record<string, unknown>>((resolve, reject) => {\n this.pendingResolve = resolve\n this.pendingReject = reject\n\n // Binary IPC: [4 bytes LE uint32 length][JPEG bytes]\n const lengthBuf = Buffer.allocUnsafe(4)\n lengthBuf.writeUInt32LE(jpeg.length, 0)\n this.process!.stdin!.write(Buffer.concat([lengthBuf, jpeg]))\n })\n }\n\n /** IInferenceEngine.run — wraps runJpeg for compatibility */\n async run(_input: Float32Array, _inputShape: readonly number[]): Promise<Float32Array> {\n throw new Error(\n 'PythonInferenceEngine: use runJpeg() directly — this engine operates on JPEG input',\n )\n }\n\n /** IInferenceEngine.runMultiOutput — not supported by Python engine (operates on JPEG input) */\n async runMultiOutput(\n _input: Float32Array,\n _inputShape: readonly number[],\n ): Promise<Record<string, Float32Array>> {\n throw new Error(\n 'PythonInferenceEngine: runMultiOutput() is not supported — this engine operates on JPEG input',\n )\n }\n\n async dispose(): Promise<void> {\n if (this.process) {\n this.process.stdin?.end()\n this.process.kill('SIGTERM')\n this.process = null\n }\n }\n}\n\n/**\n * Resolve Python binary for ML inference. Priority:\n * 1. Explicit config pythonPath\n * 2. Embedded (data/deps/python/bin/python3)\n * 3. System PATH (python3, python)\n * 4. Download standalone Python\n *\n * Returns null if Python is not available.\n */\nexport async function resolvePythonBinary(\n configPath: string | undefined,\n deps: IAddonDepsManager,\n): Promise<string | null> {\n if (configPath) return configPath\n return deps.ensurePython()\n}\n","// TODO: Wire PythonInferenceEngine for PyTorch/OpenVINO/TFLite runtimes\n// Currently falls back to ONNX CPU when non-ONNX runtime is requested.\n// See: packages/addon-vision/python/ for stub implementations.\n//\n// WHY THIS FILE USES RAW FILESYSTEM PATHS (modelsDir: string):\n//\n// Model files must be loaded via absolute filesystem paths because inference\n// engines (ONNX Runtime, CoreML, etc.) require direct file access -- they do\n// not accept Buffer or stream inputs. This is fundamentally different from\n// user data (recordings, media) where IAddonFileStorage abstraction makes\n// sense. Models are closer to binaries or compiled artifacts that must live\n// on the local filesystem at runtime.\n//\n// IAddonFileStorage.readFile() returns a Buffer, but onnxruntime-node's\n// InferenceSession.create() only accepts a file path string or a Uint8Array\n// loaded into memory. For large models (hundreds of MB), loading into a\n// Uint8Array is impractical. Therefore, modelsDir stays as a raw string path\n// and is intentionally NOT replaced with IAddonFileStorage here.\n\nimport type {\n IInferenceEngine,\n DetectionRuntime,\n ModelCatalogEntry,\n ModelFormat,\n IAddonModelManager,\n} from '@camstack/types'\nimport * as fs from 'node:fs'\nimport * as path from 'node:path'\nimport { NodeInferenceEngine } from './node-engine.js'\nimport { PythonInferenceEngine } from './python-engine.js'\n\nexport interface EngineResolverOptions {\n readonly runtime: DetectionRuntime | 'auto'\n readonly backend: string\n readonly modelEntry: ModelCatalogEntry\n readonly modelsDir: string\n readonly pythonPath?: string\n /** Model service for downloading models. When provided, used instead of raw filesystem probing. */\n readonly models?: IAddonModelManager\n}\n\nexport interface ResolvedEngine {\n readonly engine: IInferenceEngine\n readonly format: ModelFormat\n readonly modelPath: string\n}\n\n/** Priority order for auto-selection of ONNX backends */\nconst AUTO_BACKEND_PRIORITY = ['coreml', 'cuda', 'tensorrt', 'cpu'] as const\n\n/** Map backend names to the model format they require.\n * CoreML backend uses ONNX format -- onnxruntime-node loads the .onnx file\n * and accelerates it via the CoreML execution provider internally.\n * Native .mlpackage is only for PythonInferenceEngine. */\nconst BACKEND_TO_FORMAT: Readonly<Record<string, ModelFormat>> = {\n cpu: 'onnx',\n coreml: 'onnx',\n cuda: 'onnx',\n tensorrt: 'onnx',\n} as const\n\n/** Map DetectionRuntime to ModelFormat */\nconst RUNTIME_TO_FORMAT: Readonly<Partial<Record<DetectionRuntime, ModelFormat>>> = {\n onnx: 'onnx',\n coreml: 'coreml',\n openvino: 'openvino',\n tflite: 'tflite',\n pytorch: 'pt',\n} as const\n\nfunction modelFilePath(modelsDir: string, modelEntry: ModelCatalogEntry, format: ModelFormat): string {\n const formatEntry = modelEntry.formats[format]\n if (!formatEntry) {\n throw new Error(`Model ${modelEntry.id} has no ${format} format`)\n }\n // Derive filename from URL\n const urlParts = formatEntry.url.split('/')\n const filename = urlParts[urlParts.length - 1] ?? `${modelEntry.id}.${format}`\n return path.join(modelsDir, filename)\n}\n\nfunction modelExists(filePath: string): boolean {\n try {\n return fs.existsSync(filePath)\n } catch {\n return false\n }\n}\n\nexport async function resolveEngine(options: EngineResolverOptions): Promise<ResolvedEngine> {\n const { runtime, backend, modelEntry, modelsDir, models } = options\n\n let selectedFormat: ModelFormat\n let selectedBackend: string\n\n if (runtime === 'auto') {\n // Probe available ONNX backends and pick best\n const available = await probeOnnxBackends()\n\n // Pick first priority backend that has a corresponding model format available\n let chosen: { backend: string; format: ModelFormat } | null = null\n\n for (const b of AUTO_BACKEND_PRIORITY) {\n if (!available.includes(b)) continue\n const fmt = BACKEND_TO_FORMAT[b]\n if (!fmt) continue\n if (!modelEntry.formats[fmt]) continue\n chosen = { backend: b, format: fmt }\n break\n }\n\n if (!chosen) {\n throw new Error(\n `resolveEngine: no compatible backend found for model ${modelEntry.id}. Available backends: ${available.join(', ')}`,\n )\n }\n\n selectedFormat = chosen.format\n selectedBackend = chosen.backend\n } else {\n // Explicit runtime requested\n const fmt = RUNTIME_TO_FORMAT[runtime]\n if (!fmt) {\n throw new Error(`resolveEngine: unsupported runtime \"${runtime}\"`)\n }\n if (!modelEntry.formats[fmt]) {\n throw new Error(\n `resolveEngine: model ${modelEntry.id} has no ${fmt} format for runtime ${runtime}`,\n )\n }\n selectedFormat = fmt\n // For onnx runtime, use the provided backend; otherwise use the runtime name\n selectedBackend = runtime === 'onnx' ? (backend || 'cpu') : runtime\n }\n\n // Download model and extra files via the unified service\n let modelPath: string\n\n if (models) {\n // Use the unified ModelDownloadService\n modelPath = await models.ensure(modelEntry.id, selectedFormat)\n } else {\n // Fallback: direct filesystem check (no download capability)\n modelPath = modelFilePath(modelsDir, modelEntry, selectedFormat)\n if (!modelExists(modelPath)) {\n throw new Error(\n `resolveEngine: model file not found at ${modelPath} and no model service provided`,\n )\n }\n }\n\n // NodeInferenceEngine handles ONNX format only (with any ONNX backend including CoreML provider).\n // Native .mlpackage/.mlmodel files go to PythonInferenceEngine below.\n if (selectedFormat === 'onnx') {\n const engine = new NodeInferenceEngine(modelPath, selectedBackend)\n await engine.initialize()\n return { engine, format: selectedFormat, modelPath }\n }\n\n // For non-ONNX/CoreML formats, try PythonInferenceEngine when a python binary is available\n const { pythonPath } = options\n const PYTHON_SCRIPT_MAP: Readonly<Record<string, string>> = {\n coreml: 'coreml_inference.py',\n pytorch: 'pytorch_inference.py',\n openvino: 'openvino_inference.py',\n } as const\n\n const effectiveRuntime = runtime === 'auto' ? selectedBackend : runtime\n const scriptName = PYTHON_SCRIPT_MAP[effectiveRuntime]\n\n if (scriptName && pythonPath) {\n // Resolve python script path -- search multiple locations:\n // - src/shared/ -> ../../python/ (source development)\n // - dist/shared/ -> ../../python/ (installed addon with python/ at package root)\n // - dist/ -> ../python/ (flat dist)\n const candidates = [\n path.join(__dirname, '../../python', scriptName),\n path.join(__dirname, '../python', scriptName),\n path.join(__dirname, '../../../python', scriptName),\n ]\n const scriptPath = candidates.find(p => fs.existsSync(p))\n if (!scriptPath) {\n throw new Error(\n `resolveEngine: Python script \"${scriptName}\" not found. Searched:\\n${candidates.join('\\n')}`,\n )\n }\n const inputSize = Math.max(modelEntry.inputSize.width, modelEntry.inputSize.height)\n const engine = new PythonInferenceEngine(pythonPath, scriptPath, effectiveRuntime as DetectionRuntime, modelPath, [\n `--input-size=${inputSize}`,\n `--confidence=0.25`,\n ])\n await engine.initialize()\n return { engine, format: selectedFormat, modelPath }\n }\n\n // Final fallback: use ONNX CPU if available\n const fallbackPath = modelFilePath(modelsDir, modelEntry, 'onnx')\n if (modelEntry.formats['onnx'] && modelExists(fallbackPath)) {\n const engine = new NodeInferenceEngine(fallbackPath, 'cpu')\n await engine.initialize()\n return { engine, format: 'onnx', modelPath: fallbackPath }\n }\n\n throw new Error(\n `resolveEngine: format ${selectedFormat} is not yet supported by NodeInferenceEngine, ` +\n `no Python runtime is available, and no ONNX fallback exists`,\n )\n}\n\n/** Probe which ONNX execution providers are available on this system */\nexport async function probeOnnxBackends(): Promise<string[]> {\n const available: string[] = ['cpu'] // CPU is always available\n\n try {\n const ort = await import('onnxruntime-node')\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const providers: string[] = (ort as any).env?.webgl?.disabled !== undefined\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ? ((ort as any).InferenceSession?.getAvailableProviders?.() ?? [])\n : []\n\n for (const p of providers) {\n const normalized = p.toLowerCase().replace('executionprovider', '')\n if (normalized === 'coreml') available.push('coreml')\n else if (normalized === 'cuda') available.push('cuda')\n else if (normalized === 'tensorrt') available.push('tensorrt')\n }\n } catch {\n // onnxruntime-node may not be installed; CPU only\n }\n\n // Platform-specific hints when getAvailableProviders isn't exposed\n if (process.platform === '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SAAS,QAAQ,GAAG;AAClE,cAAU,KAAK,QAAQ;AAAA,EACzB;AAEA,SAAO,CAAC,GAAG,IAAI,IAAI,SAAS,CAAC;AAC/B;","names":["resolve","path"]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  resolveEngine
3
- } from "./chunk-6DJZZR64.mjs";
3
+ } from "./chunk-2IOKI4ES.mjs";
4
4
 
5
5
  // src/catalogs/audio-classification-models.ts
6
6
  import { hfModelUrl } from "@camstack/types";
@@ -273,4 +273,4 @@ export {
273
273
  AUDIO_CLASSIFICATION_MODELS,
274
274
  AudioClassificationAddon
275
275
  };
276
- //# sourceMappingURL=chunk-H7LMBTS5.mjs.map
276
+ //# sourceMappingURL=chunk-D6WEHN33.mjs.map
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-22BHCDT5.mjs";
8
8
  import {
9
9
  resolveEngine
10
- } from "./chunk-6DJZZR64.mjs";
10
+ } from "./chunk-2IOKI4ES.mjs";
11
11
 
12
12
  // src/addons/bird-nabirds-classifier/index.ts
13
13
  import * as fs from "fs";
@@ -286,4 +286,4 @@ var BirdNABirdsClassifierAddon = class {
286
286
  export {
287
287
  BirdNABirdsClassifierAddon
288
288
  };
289
- //# sourceMappingURL=chunk-GR65KM6X.mjs.map
289
+ //# sourceMappingURL=chunk-DRYFGARD.mjs.map
@@ -10,7 +10,7 @@ import {
10
10
  } from "./chunk-22BHCDT5.mjs";
11
11
  import {
12
12
  resolveEngine
13
- } from "./chunk-6DJZZR64.mjs";
13
+ } from "./chunk-2IOKI4ES.mjs";
14
14
 
15
15
  // src/catalogs/face-detection-models.ts
16
16
  import { hfModelUrl } from "@camstack/types";
@@ -384,4 +384,4 @@ export {
384
384
  FACE_DETECTION_MODELS,
385
385
  FaceDetectionAddon
386
386
  };
387
- //# sourceMappingURL=chunk-EPNWLSCG.mjs.map
387
+ //# sourceMappingURL=chunk-ESLHNWWE.mjs.map
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-22BHCDT5.mjs";
8
8
  import {
9
9
  resolveEngine
10
- } from "./chunk-6DJZZR64.mjs";
10
+ } from "./chunk-2IOKI4ES.mjs";
11
11
 
12
12
  // src/catalogs/face-recognition-models.ts
13
13
  import { hfModelUrl } from "@camstack/types";
@@ -253,4 +253,4 @@ export {
253
253
  FACE_RECOGNITION_MODELS,
254
254
  FaceRecognitionAddon
255
255
  };
256
- //# sourceMappingURL=chunk-DNQNGDR4.mjs.map
256
+ //# sourceMappingURL=chunk-JUQEW6ON.mjs.map
@@ -11,7 +11,7 @@ import {
11
11
  } from "./chunk-22BHCDT5.mjs";
12
12
  import {
13
13
  resolveEngine
14
- } from "./chunk-6DJZZR64.mjs";
14
+ } from "./chunk-2IOKI4ES.mjs";
15
15
 
16
16
  // src/catalogs/segmentation-models.ts
17
17
  import { hfModelUrl, COCO_80_LABELS } from "@camstack/types";
@@ -642,4 +642,4 @@ export {
642
642
  SEGMENTATION_MODELS,
643
643
  ObjectDetectionAddon
644
644
  };
645
- //# sourceMappingURL=chunk-G32RCIUI.mjs.map
645
+ //# sourceMappingURL=chunk-R5J3WAUI.mjs.map
@@ -10,7 +10,7 @@ import {
10
10
  } from "./chunk-22BHCDT5.mjs";
11
11
  import {
12
12
  resolveEngine
13
- } from "./chunk-6DJZZR64.mjs";
13
+ } from "./chunk-2IOKI4ES.mjs";
14
14
 
15
15
  // src/catalogs/plate-detection-models.ts
16
16
  import { hfModelUrl } from "@camstack/types";
@@ -266,4 +266,4 @@ export {
266
266
  PLATE_DETECTION_MODELS,
267
267
  PlateDetectionAddon
268
268
  };
269
- //# sourceMappingURL=chunk-J6VNIIYX.mjs.map
269
+ //# sourceMappingURL=chunk-YPU4WTXZ.mjs.map
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-22BHCDT5.mjs";
8
8
  import {
9
9
  resolveEngine
10
- } from "./chunk-6DJZZR64.mjs";
10
+ } from "./chunk-2IOKI4ES.mjs";
11
11
 
12
12
  // src/addons/animal-classifier/index.ts
13
13
  var ANIMAL_TYPE_LABEL = { id: "animal-type", name: "Animal Type" };
@@ -239,4 +239,4 @@ var AnimalClassifierAddon = class {
239
239
  export {
240
240
  AnimalClassifierAddon
241
241
  };
242
- //# sourceMappingURL=chunk-IK4XIQPC.mjs.map
242
+ //# sourceMappingURL=chunk-YUCD2TFH.mjs.map
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-22BHCDT5.mjs";
5
5
  import {
6
6
  resolveEngine
7
- } from "./chunk-6DJZZR64.mjs";
7
+ } from "./chunk-2IOKI4ES.mjs";
8
8
  import {
9
9
  __require
10
10
  } from "./chunk-BJTO5JO5.mjs";
@@ -376,4 +376,4 @@ export {
376
376
  PLATE_RECOGNITION_MODELS,
377
377
  PlateRecognitionAddon
378
378
  };
379
- //# sourceMappingURL=chunk-WUMV524J.mjs.map
379
+ //# sourceMappingURL=chunk-ZTJENCFC.mjs.map
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-22BHCDT5.mjs";
8
8
  import {
9
9
  resolveEngine
10
- } from "./chunk-6DJZZR64.mjs";
10
+ } from "./chunk-2IOKI4ES.mjs";
11
11
 
12
12
  // src/addons/bird-global-classifier/index.ts
13
13
  import * as fs from "fs";
@@ -245,4 +245,4 @@ var BirdGlobalClassifierAddon = class {
245
245
  export {
246
246
  BirdGlobalClassifierAddon
247
247
  };
248
- //# sourceMappingURL=chunk-ML2JX43J.mjs.map
248
+ //# sourceMappingURL=chunk-ZWYXXCXP.mjs.map
package/dist/index.js CHANGED
@@ -477,7 +477,6 @@ var NodeInferenceEngine = class {
477
477
 
478
478
  // src/shared/python-engine.ts
479
479
  var import_node_child_process = require("child_process");
480
- var import_core = require("@camstack/core");
481
480
  var PythonInferenceEngine = class {
482
481
  constructor(pythonPath, scriptPath, runtime, modelPath, extraArgs = []) {
483
482
  this.pythonPath = pythonPath;