@camstack/addon-vision 0.1.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.
Files changed (109) hide show
  1. package/dist/addons/animal-classifier/index.d.mts +25 -0
  2. package/dist/addons/animal-classifier/index.d.ts +25 -0
  3. package/dist/addons/animal-classifier/index.js +652 -0
  4. package/dist/addons/animal-classifier/index.js.map +1 -0
  5. package/dist/addons/animal-classifier/index.mjs +10 -0
  6. package/dist/addons/animal-classifier/index.mjs.map +1 -0
  7. package/dist/addons/audio-classification/index.d.mts +31 -0
  8. package/dist/addons/audio-classification/index.d.ts +31 -0
  9. package/dist/addons/audio-classification/index.js +572 -0
  10. package/dist/addons/audio-classification/index.js.map +1 -0
  11. package/dist/addons/audio-classification/index.mjs +8 -0
  12. package/dist/addons/audio-classification/index.mjs.map +1 -0
  13. package/dist/addons/bird-global-classifier/index.d.mts +26 -0
  14. package/dist/addons/bird-global-classifier/index.d.ts +26 -0
  15. package/dist/addons/bird-global-classifier/index.js +658 -0
  16. package/dist/addons/bird-global-classifier/index.js.map +1 -0
  17. package/dist/addons/bird-global-classifier/index.mjs +10 -0
  18. package/dist/addons/bird-global-classifier/index.mjs.map +1 -0
  19. package/dist/addons/bird-nabirds-classifier/index.d.mts +28 -0
  20. package/dist/addons/bird-nabirds-classifier/index.d.ts +28 -0
  21. package/dist/addons/bird-nabirds-classifier/index.js +700 -0
  22. package/dist/addons/bird-nabirds-classifier/index.js.map +1 -0
  23. package/dist/addons/bird-nabirds-classifier/index.mjs +10 -0
  24. package/dist/addons/bird-nabirds-classifier/index.mjs.map +1 -0
  25. package/dist/addons/camera-native-detection/index.d.mts +32 -0
  26. package/dist/addons/camera-native-detection/index.d.ts +32 -0
  27. package/dist/addons/camera-native-detection/index.js +99 -0
  28. package/dist/addons/camera-native-detection/index.js.map +1 -0
  29. package/dist/addons/camera-native-detection/index.mjs +7 -0
  30. package/dist/addons/camera-native-detection/index.mjs.map +1 -0
  31. package/dist/addons/face-detection/index.d.mts +24 -0
  32. package/dist/addons/face-detection/index.d.ts +24 -0
  33. package/dist/addons/face-detection/index.js +720 -0
  34. package/dist/addons/face-detection/index.js.map +1 -0
  35. package/dist/addons/face-detection/index.mjs +10 -0
  36. package/dist/addons/face-detection/index.mjs.map +1 -0
  37. package/dist/addons/face-recognition/index.d.mts +24 -0
  38. package/dist/addons/face-recognition/index.d.ts +24 -0
  39. package/dist/addons/face-recognition/index.js +603 -0
  40. package/dist/addons/face-recognition/index.js.map +1 -0
  41. package/dist/addons/face-recognition/index.mjs +9 -0
  42. package/dist/addons/face-recognition/index.mjs.map +1 -0
  43. package/dist/addons/motion-detection/index.d.mts +26 -0
  44. package/dist/addons/motion-detection/index.d.ts +26 -0
  45. package/dist/addons/motion-detection/index.js +273 -0
  46. package/dist/addons/motion-detection/index.js.map +1 -0
  47. package/dist/addons/motion-detection/index.mjs +8 -0
  48. package/dist/addons/motion-detection/index.mjs.map +1 -0
  49. package/dist/addons/object-detection/index.d.mts +26 -0
  50. package/dist/addons/object-detection/index.d.ts +26 -0
  51. package/dist/addons/object-detection/index.js +1214 -0
  52. package/dist/addons/object-detection/index.js.map +1 -0
  53. package/dist/addons/object-detection/index.mjs +10 -0
  54. package/dist/addons/object-detection/index.mjs.map +1 -0
  55. package/dist/addons/plate-detection/index.d.mts +25 -0
  56. package/dist/addons/plate-detection/index.d.ts +25 -0
  57. package/dist/addons/plate-detection/index.js +646 -0
  58. package/dist/addons/plate-detection/index.js.map +1 -0
  59. package/dist/addons/plate-detection/index.mjs +10 -0
  60. package/dist/addons/plate-detection/index.mjs.map +1 -0
  61. package/dist/addons/plate-recognition/index.d.mts +25 -0
  62. package/dist/addons/plate-recognition/index.d.ts +25 -0
  63. package/dist/addons/plate-recognition/index.js +648 -0
  64. package/dist/addons/plate-recognition/index.js.map +1 -0
  65. package/dist/addons/plate-recognition/index.mjs +9 -0
  66. package/dist/addons/plate-recognition/index.mjs.map +1 -0
  67. package/dist/chunk-3MQFUDRU.mjs +260 -0
  68. package/dist/chunk-3MQFUDRU.mjs.map +1 -0
  69. package/dist/chunk-5AIQSN32.mjs +227 -0
  70. package/dist/chunk-5AIQSN32.mjs.map +1 -0
  71. package/dist/chunk-5JJZGKL7.mjs +186 -0
  72. package/dist/chunk-5JJZGKL7.mjs.map +1 -0
  73. package/dist/chunk-6OR5TE7A.mjs +101 -0
  74. package/dist/chunk-6OR5TE7A.mjs.map +1 -0
  75. package/dist/chunk-AYBFB7ID.mjs +763 -0
  76. package/dist/chunk-AYBFB7ID.mjs.map +1 -0
  77. package/dist/chunk-B3R66MPF.mjs +219 -0
  78. package/dist/chunk-B3R66MPF.mjs.map +1 -0
  79. package/dist/chunk-DTOAB2CE.mjs +79 -0
  80. package/dist/chunk-DTOAB2CE.mjs.map +1 -0
  81. package/dist/chunk-ISOIDU4U.mjs +54 -0
  82. package/dist/chunk-ISOIDU4U.mjs.map +1 -0
  83. package/dist/chunk-J4WRYHHY.mjs +212 -0
  84. package/dist/chunk-J4WRYHHY.mjs.map +1 -0
  85. package/dist/chunk-KUO2BVFY.mjs +90 -0
  86. package/dist/chunk-KUO2BVFY.mjs.map +1 -0
  87. package/dist/chunk-LPI42WL6.mjs +324 -0
  88. package/dist/chunk-LPI42WL6.mjs.map +1 -0
  89. package/dist/chunk-MEVASN3P.mjs +305 -0
  90. package/dist/chunk-MEVASN3P.mjs.map +1 -0
  91. package/dist/chunk-PDSHDDPV.mjs +255 -0
  92. package/dist/chunk-PDSHDDPV.mjs.map +1 -0
  93. package/dist/chunk-Q3SQOYG6.mjs +218 -0
  94. package/dist/chunk-Q3SQOYG6.mjs.map +1 -0
  95. package/dist/chunk-QIMDG34B.mjs +229 -0
  96. package/dist/chunk-QIMDG34B.mjs.map +1 -0
  97. package/dist/index.d.mts +171 -0
  98. package/dist/index.d.ts +171 -0
  99. package/dist/index.js +3463 -0
  100. package/dist/index.js.map +1 -0
  101. package/dist/index.mjs +111 -0
  102. package/dist/index.mjs.map +1 -0
  103. package/package.json +49 -0
  104. package/python/__pycache__/coreml_inference.cpython-313.pyc +0 -0
  105. package/python/__pycache__/openvino_inference.cpython-313.pyc +0 -0
  106. package/python/__pycache__/pytorch_inference.cpython-313.pyc +0 -0
  107. package/python/coreml_inference.py +319 -0
  108. package/python/openvino_inference.py +247 -0
  109. package/python/pytorch_inference.py +255 -0
@@ -0,0 +1,171 @@
1
+ import { BoundingBox, SpatialDetection, IInferenceEngine, DetectionRuntime, DetectionDevice, ModelCatalogEntry, ModelFormat } from '@camstack/types';
2
+ export { default as ObjectDetectionAddon } from './addons/object-detection/index.mjs';
3
+ export { default as MotionDetectionAddon } from './addons/motion-detection/index.mjs';
4
+ export { default as FaceDetectionAddon } from './addons/face-detection/index.mjs';
5
+ export { default as FaceRecognitionAddon } from './addons/face-recognition/index.mjs';
6
+ export { default as PlateDetectionAddon } from './addons/plate-detection/index.mjs';
7
+ export { default as PlateRecognitionAddon } from './addons/plate-recognition/index.mjs';
8
+ export { default as AudioClassificationAddon } from './addons/audio-classification/index.mjs';
9
+ export { default as CameraNativeDetectionAddon } from './addons/camera-native-detection/index.mjs';
10
+ export { default as BirdGlobalClassifierAddon } from './addons/bird-global-classifier/index.mjs';
11
+ export { default as BirdNABirdsClassifierAddon } from './addons/bird-nabirds-classifier/index.mjs';
12
+ export { default as AnimalClassifierAddon } from './addons/animal-classifier/index.mjs';
13
+
14
+ /** Decode JPEG to raw RGB pixels */
15
+ declare function jpegToRgb(jpeg: Buffer): Promise<{
16
+ data: Buffer;
17
+ width: number;
18
+ height: number;
19
+ }>;
20
+ /** Crop a region from a JPEG buffer */
21
+ declare function cropRegion(jpeg: Buffer, roi: BoundingBox): Promise<Buffer>;
22
+ /** Letterbox resize for YOLO: resize preserving aspect ratio, pad to square */
23
+ declare function letterbox(jpeg: Buffer, targetSize: number): Promise<{
24
+ data: Float32Array;
25
+ scale: number;
26
+ padX: number;
27
+ padY: number;
28
+ originalWidth: number;
29
+ originalHeight: number;
30
+ }>;
31
+ /** Resize and normalize to Float32Array */
32
+ declare function resizeAndNormalize(jpeg: Buffer, targetWidth: number, targetHeight: number, normalization: 'zero-one' | 'imagenet' | 'none', layout: 'nchw' | 'nhwc'): Promise<Float32Array>;
33
+ /** Convert raw RGB to grayscale Uint8Array */
34
+ declare function rgbToGrayscale(rgb: Buffer, width: number, height: number): Uint8Array;
35
+
36
+ interface YoloPostprocessOptions {
37
+ readonly confidence: number;
38
+ readonly iouThreshold: number;
39
+ readonly labels: readonly string[];
40
+ readonly scale: number;
41
+ readonly padX: number;
42
+ readonly padY: number;
43
+ readonly originalWidth: number;
44
+ readonly originalHeight: number;
45
+ }
46
+ /** Calculate IoU between two bounding boxes */
47
+ declare function iou(a: BoundingBox, b: BoundingBox): number;
48
+ /** Non-maximum suppression — returns indices of kept boxes (sorted by score desc) */
49
+ declare function nms(boxes: ReadonlyArray<{
50
+ readonly bbox: BoundingBox;
51
+ readonly score: number;
52
+ }>, iouThreshold: number): number[];
53
+ /** Full YOLO v8/v9 postprocessing: filter → NMS → scale back to original coords */
54
+ declare function yoloPostprocess(output: Float32Array, numClasses: number, numBoxes: number, options: YoloPostprocessOptions): SpatialDetection[];
55
+
56
+ interface ScrfdRawOutputs {
57
+ readonly [key: string]: Float32Array;
58
+ }
59
+ declare function scrfdPostprocess(outputs: ScrfdRawOutputs, confidence: number, inputSize: number, originalWidth: number, originalHeight: number): SpatialDetection[];
60
+
61
+ /** L2 normalize a vector in-place, returning a new Float32Array */
62
+ declare function l2Normalize(vec: Float32Array): Float32Array;
63
+ /** Cosine similarity between two embeddings (assumes they are already L2-normalized) */
64
+ declare function cosineSimilarity(a: Float32Array, b: Float32Array): number;
65
+
66
+ /** Decode CTC output to text.
67
+ *
68
+ * Output shape: [1, seqLen, numChars]
69
+ * Algorithm: argmax per timestep → collapse consecutive duplicates → remove blank (index 0) → join
70
+ */
71
+ declare function ctcDecode(output: Float32Array, seqLen: number, numChars: number, charset: readonly string[]): {
72
+ text: string;
73
+ confidence: number;
74
+ };
75
+
76
+ interface AudioClassification {
77
+ readonly className: string;
78
+ readonly score: number;
79
+ }
80
+ /** Average YAMNET scores across frames, return top classes above threshold */
81
+ declare function yamnetPostprocess(output: Float32Array, numFrames: number, numClasses: number, classNames: readonly string[], minScore: number): AudioClassification[];
82
+
83
+ declare class NodeInferenceEngine implements IInferenceEngine {
84
+ private readonly modelPath;
85
+ private readonly backend;
86
+ readonly runtime: DetectionRuntime;
87
+ readonly device: DetectionDevice;
88
+ private session;
89
+ constructor(modelPath: string, backend: string);
90
+ initialize(): Promise<void>;
91
+ run(input: Float32Array, inputShape: readonly number[]): Promise<Float32Array>;
92
+ runMultiOutput(input: Float32Array, inputShape: readonly number[]): Promise<Record<string, Float32Array>>;
93
+ dispose(): Promise<void>;
94
+ }
95
+
96
+ declare class PythonInferenceEngine implements IInferenceEngine {
97
+ private readonly pythonPath;
98
+ private readonly scriptPath;
99
+ private readonly modelPath;
100
+ private readonly extraArgs;
101
+ readonly runtime: DetectionRuntime;
102
+ readonly device: DetectionDevice;
103
+ private process;
104
+ private receiveBuffer;
105
+ private pendingResolve;
106
+ private pendingReject;
107
+ constructor(pythonPath: string, scriptPath: string, runtime: DetectionRuntime, modelPath: string, extraArgs?: readonly string[]);
108
+ initialize(): Promise<void>;
109
+ private _tryReceive;
110
+ /** Send JPEG buffer, receive JSON detection results */
111
+ runJpeg(jpeg: Buffer): Promise<Record<string, unknown>>;
112
+ /** IInferenceEngine.run — wraps runJpeg for compatibility */
113
+ run(_input: Float32Array, _inputShape: readonly number[]): Promise<Float32Array>;
114
+ /** IInferenceEngine.runMultiOutput — not supported by Python engine (operates on JPEG input) */
115
+ runMultiOutput(_input: Float32Array, _inputShape: readonly number[]): Promise<Record<string, Float32Array>>;
116
+ dispose(): Promise<void>;
117
+ }
118
+
119
+ interface EngineResolverOptions {
120
+ readonly runtime: DetectionRuntime | 'auto';
121
+ readonly backend: string;
122
+ readonly modelEntry: ModelCatalogEntry;
123
+ readonly modelsDir: string;
124
+ readonly pythonPath?: string;
125
+ readonly downloadModel?: (url: string, destDir: string) => Promise<string>;
126
+ }
127
+ interface ResolvedEngine {
128
+ readonly engine: IInferenceEngine;
129
+ readonly format: ModelFormat;
130
+ readonly modelPath: string;
131
+ }
132
+ declare function resolveEngine(options: EngineResolverOptions): Promise<ResolvedEngine>;
133
+ /** Probe which ONNX execution providers are available on this system */
134
+ declare function probeOnnxBackends(): Promise<string[]>;
135
+
136
+ interface MotionRegion {
137
+ readonly bbox: BoundingBox;
138
+ readonly pixelCount: number;
139
+ readonly intensity: number;
140
+ }
141
+ /**
142
+ * Detect motion by frame differencing.
143
+ *
144
+ * @param current - Grayscale pixel array for the current frame (Uint8Array, length = width * height)
145
+ * @param previous - Grayscale pixel array for the previous frame
146
+ * @param width - Frame width in pixels
147
+ * @param height - Frame height in pixels
148
+ * @param threshold - Pixel diff threshold 0-255; differences below this are ignored
149
+ * @param minArea - Minimum number of changed pixels for a region to be reported
150
+ */
151
+ declare function detectMotion(current: Uint8Array, previous: Uint8Array, width: number, height: number, threshold: number, minArea: number): MotionRegion[];
152
+
153
+ declare const OBJECT_DETECTION_MODELS: readonly ModelCatalogEntry[];
154
+
155
+ declare const FACE_DETECTION_MODELS: readonly ModelCatalogEntry[];
156
+
157
+ declare const FACE_RECOGNITION_MODELS: readonly ModelCatalogEntry[];
158
+
159
+ declare const PLATE_DETECTION_MODELS: readonly ModelCatalogEntry[];
160
+
161
+ declare const PLATE_RECOGNITION_MODELS: readonly ModelCatalogEntry[];
162
+
163
+ declare const AUDIO_CLASSIFICATION_MODELS: readonly ModelCatalogEntry[];
164
+
165
+ declare const SEGMENTATION_MODELS: readonly ModelCatalogEntry[];
166
+
167
+ declare const BIRD_SPECIES_MODELS: readonly ModelCatalogEntry[];
168
+ declare const BIRD_NABIRDS_MODELS: readonly ModelCatalogEntry[];
169
+ declare const ANIMAL_TYPE_MODELS: readonly ModelCatalogEntry[];
170
+
171
+ export { ANIMAL_TYPE_MODELS, AUDIO_CLASSIFICATION_MODELS, BIRD_NABIRDS_MODELS, BIRD_SPECIES_MODELS, type EngineResolverOptions, FACE_DETECTION_MODELS, FACE_RECOGNITION_MODELS, type MotionRegion, NodeInferenceEngine, OBJECT_DETECTION_MODELS, PLATE_DETECTION_MODELS, PLATE_RECOGNITION_MODELS, PythonInferenceEngine, type ResolvedEngine, SEGMENTATION_MODELS, cosineSimilarity, cropRegion, ctcDecode, detectMotion, iou, jpegToRgb, l2Normalize, letterbox, nms, probeOnnxBackends, resizeAndNormalize, resolveEngine, rgbToGrayscale, scrfdPostprocess, yamnetPostprocess, yoloPostprocess };
@@ -0,0 +1,171 @@
1
+ import { BoundingBox, SpatialDetection, IInferenceEngine, DetectionRuntime, DetectionDevice, ModelCatalogEntry, ModelFormat } from '@camstack/types';
2
+ export { default as ObjectDetectionAddon } from './addons/object-detection/index.js';
3
+ export { default as MotionDetectionAddon } from './addons/motion-detection/index.js';
4
+ export { default as FaceDetectionAddon } from './addons/face-detection/index.js';
5
+ export { default as FaceRecognitionAddon } from './addons/face-recognition/index.js';
6
+ export { default as PlateDetectionAddon } from './addons/plate-detection/index.js';
7
+ export { default as PlateRecognitionAddon } from './addons/plate-recognition/index.js';
8
+ export { default as AudioClassificationAddon } from './addons/audio-classification/index.js';
9
+ export { default as CameraNativeDetectionAddon } from './addons/camera-native-detection/index.js';
10
+ export { default as BirdGlobalClassifierAddon } from './addons/bird-global-classifier/index.js';
11
+ export { default as BirdNABirdsClassifierAddon } from './addons/bird-nabirds-classifier/index.js';
12
+ export { default as AnimalClassifierAddon } from './addons/animal-classifier/index.js';
13
+
14
+ /** Decode JPEG to raw RGB pixels */
15
+ declare function jpegToRgb(jpeg: Buffer): Promise<{
16
+ data: Buffer;
17
+ width: number;
18
+ height: number;
19
+ }>;
20
+ /** Crop a region from a JPEG buffer */
21
+ declare function cropRegion(jpeg: Buffer, roi: BoundingBox): Promise<Buffer>;
22
+ /** Letterbox resize for YOLO: resize preserving aspect ratio, pad to square */
23
+ declare function letterbox(jpeg: Buffer, targetSize: number): Promise<{
24
+ data: Float32Array;
25
+ scale: number;
26
+ padX: number;
27
+ padY: number;
28
+ originalWidth: number;
29
+ originalHeight: number;
30
+ }>;
31
+ /** Resize and normalize to Float32Array */
32
+ declare function resizeAndNormalize(jpeg: Buffer, targetWidth: number, targetHeight: number, normalization: 'zero-one' | 'imagenet' | 'none', layout: 'nchw' | 'nhwc'): Promise<Float32Array>;
33
+ /** Convert raw RGB to grayscale Uint8Array */
34
+ declare function rgbToGrayscale(rgb: Buffer, width: number, height: number): Uint8Array;
35
+
36
+ interface YoloPostprocessOptions {
37
+ readonly confidence: number;
38
+ readonly iouThreshold: number;
39
+ readonly labels: readonly string[];
40
+ readonly scale: number;
41
+ readonly padX: number;
42
+ readonly padY: number;
43
+ readonly originalWidth: number;
44
+ readonly originalHeight: number;
45
+ }
46
+ /** Calculate IoU between two bounding boxes */
47
+ declare function iou(a: BoundingBox, b: BoundingBox): number;
48
+ /** Non-maximum suppression — returns indices of kept boxes (sorted by score desc) */
49
+ declare function nms(boxes: ReadonlyArray<{
50
+ readonly bbox: BoundingBox;
51
+ readonly score: number;
52
+ }>, iouThreshold: number): number[];
53
+ /** Full YOLO v8/v9 postprocessing: filter → NMS → scale back to original coords */
54
+ declare function yoloPostprocess(output: Float32Array, numClasses: number, numBoxes: number, options: YoloPostprocessOptions): SpatialDetection[];
55
+
56
+ interface ScrfdRawOutputs {
57
+ readonly [key: string]: Float32Array;
58
+ }
59
+ declare function scrfdPostprocess(outputs: ScrfdRawOutputs, confidence: number, inputSize: number, originalWidth: number, originalHeight: number): SpatialDetection[];
60
+
61
+ /** L2 normalize a vector in-place, returning a new Float32Array */
62
+ declare function l2Normalize(vec: Float32Array): Float32Array;
63
+ /** Cosine similarity between two embeddings (assumes they are already L2-normalized) */
64
+ declare function cosineSimilarity(a: Float32Array, b: Float32Array): number;
65
+
66
+ /** Decode CTC output to text.
67
+ *
68
+ * Output shape: [1, seqLen, numChars]
69
+ * Algorithm: argmax per timestep → collapse consecutive duplicates → remove blank (index 0) → join
70
+ */
71
+ declare function ctcDecode(output: Float32Array, seqLen: number, numChars: number, charset: readonly string[]): {
72
+ text: string;
73
+ confidence: number;
74
+ };
75
+
76
+ interface AudioClassification {
77
+ readonly className: string;
78
+ readonly score: number;
79
+ }
80
+ /** Average YAMNET scores across frames, return top classes above threshold */
81
+ declare function yamnetPostprocess(output: Float32Array, numFrames: number, numClasses: number, classNames: readonly string[], minScore: number): AudioClassification[];
82
+
83
+ declare class NodeInferenceEngine implements IInferenceEngine {
84
+ private readonly modelPath;
85
+ private readonly backend;
86
+ readonly runtime: DetectionRuntime;
87
+ readonly device: DetectionDevice;
88
+ private session;
89
+ constructor(modelPath: string, backend: string);
90
+ initialize(): Promise<void>;
91
+ run(input: Float32Array, inputShape: readonly number[]): Promise<Float32Array>;
92
+ runMultiOutput(input: Float32Array, inputShape: readonly number[]): Promise<Record<string, Float32Array>>;
93
+ dispose(): Promise<void>;
94
+ }
95
+
96
+ declare class PythonInferenceEngine implements IInferenceEngine {
97
+ private readonly pythonPath;
98
+ private readonly scriptPath;
99
+ private readonly modelPath;
100
+ private readonly extraArgs;
101
+ readonly runtime: DetectionRuntime;
102
+ readonly device: DetectionDevice;
103
+ private process;
104
+ private receiveBuffer;
105
+ private pendingResolve;
106
+ private pendingReject;
107
+ constructor(pythonPath: string, scriptPath: string, runtime: DetectionRuntime, modelPath: string, extraArgs?: readonly string[]);
108
+ initialize(): Promise<void>;
109
+ private _tryReceive;
110
+ /** Send JPEG buffer, receive JSON detection results */
111
+ runJpeg(jpeg: Buffer): Promise<Record<string, unknown>>;
112
+ /** IInferenceEngine.run — wraps runJpeg for compatibility */
113
+ run(_input: Float32Array, _inputShape: readonly number[]): Promise<Float32Array>;
114
+ /** IInferenceEngine.runMultiOutput — not supported by Python engine (operates on JPEG input) */
115
+ runMultiOutput(_input: Float32Array, _inputShape: readonly number[]): Promise<Record<string, Float32Array>>;
116
+ dispose(): Promise<void>;
117
+ }
118
+
119
+ interface EngineResolverOptions {
120
+ readonly runtime: DetectionRuntime | 'auto';
121
+ readonly backend: string;
122
+ readonly modelEntry: ModelCatalogEntry;
123
+ readonly modelsDir: string;
124
+ readonly pythonPath?: string;
125
+ readonly downloadModel?: (url: string, destDir: string) => Promise<string>;
126
+ }
127
+ interface ResolvedEngine {
128
+ readonly engine: IInferenceEngine;
129
+ readonly format: ModelFormat;
130
+ readonly modelPath: string;
131
+ }
132
+ declare function resolveEngine(options: EngineResolverOptions): Promise<ResolvedEngine>;
133
+ /** Probe which ONNX execution providers are available on this system */
134
+ declare function probeOnnxBackends(): Promise<string[]>;
135
+
136
+ interface MotionRegion {
137
+ readonly bbox: BoundingBox;
138
+ readonly pixelCount: number;
139
+ readonly intensity: number;
140
+ }
141
+ /**
142
+ * Detect motion by frame differencing.
143
+ *
144
+ * @param current - Grayscale pixel array for the current frame (Uint8Array, length = width * height)
145
+ * @param previous - Grayscale pixel array for the previous frame
146
+ * @param width - Frame width in pixels
147
+ * @param height - Frame height in pixels
148
+ * @param threshold - Pixel diff threshold 0-255; differences below this are ignored
149
+ * @param minArea - Minimum number of changed pixels for a region to be reported
150
+ */
151
+ declare function detectMotion(current: Uint8Array, previous: Uint8Array, width: number, height: number, threshold: number, minArea: number): MotionRegion[];
152
+
153
+ declare const OBJECT_DETECTION_MODELS: readonly ModelCatalogEntry[];
154
+
155
+ declare const FACE_DETECTION_MODELS: readonly ModelCatalogEntry[];
156
+
157
+ declare const FACE_RECOGNITION_MODELS: readonly ModelCatalogEntry[];
158
+
159
+ declare const PLATE_DETECTION_MODELS: readonly ModelCatalogEntry[];
160
+
161
+ declare const PLATE_RECOGNITION_MODELS: readonly ModelCatalogEntry[];
162
+
163
+ declare const AUDIO_CLASSIFICATION_MODELS: readonly ModelCatalogEntry[];
164
+
165
+ declare const SEGMENTATION_MODELS: readonly ModelCatalogEntry[];
166
+
167
+ declare const BIRD_SPECIES_MODELS: readonly ModelCatalogEntry[];
168
+ declare const BIRD_NABIRDS_MODELS: readonly ModelCatalogEntry[];
169
+ declare const ANIMAL_TYPE_MODELS: readonly ModelCatalogEntry[];
170
+
171
+ export { ANIMAL_TYPE_MODELS, AUDIO_CLASSIFICATION_MODELS, BIRD_NABIRDS_MODELS, BIRD_SPECIES_MODELS, type EngineResolverOptions, FACE_DETECTION_MODELS, FACE_RECOGNITION_MODELS, type MotionRegion, NodeInferenceEngine, OBJECT_DETECTION_MODELS, PLATE_DETECTION_MODELS, PLATE_RECOGNITION_MODELS, PythonInferenceEngine, type ResolvedEngine, SEGMENTATION_MODELS, cosineSimilarity, cropRegion, ctcDecode, detectMotion, iou, jpegToRgb, l2Normalize, letterbox, nms, probeOnnxBackends, resizeAndNormalize, resolveEngine, rgbToGrayscale, scrfdPostprocess, yamnetPostprocess, yoloPostprocess };