@camstack/addon-vision 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-vision",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "Builtin detection addons for CamStack — object detection, face, plate, audio, motion",
5
5
  "keywords": [
6
6
  "camstack",
@@ -1,30 +0,0 @@
1
- import { IClassifierProvider, IDetectionAddon, AddonManifest, ModelRequirement, ResolvedInferenceConfig, AddonContext, CropInput, ClassifierOutput, ConfigUISchema, ClassMapDefinition, ModelCatalogEntry, DetectionModel, LabelDefinition, ProbeResult } from '@camstack/types';
2
-
3
- declare class AnimalClassifierAddon implements IClassifierProvider, IDetectionAddon {
4
- readonly id = "animal-classifier";
5
- readonly slot: "classifier";
6
- readonly inputClasses: readonly ["animal"];
7
- readonly outputClasses: readonly ["animal-type:*"];
8
- readonly slotPriority = 0;
9
- readonly requiredSteps: readonly [];
10
- readonly manifest: AddonManifest;
11
- private engine;
12
- private modelEntry;
13
- private minConfidence;
14
- private resolvedConfig;
15
- private ctx;
16
- getModelRequirements(): ModelRequirement[];
17
- configure(config: ResolvedInferenceConfig): void;
18
- initialize(ctx: AddonContext): Promise<void>;
19
- classify(input: CropInput): Promise<ClassifierOutput>;
20
- private ensureEngine;
21
- shutdown(): Promise<void>;
22
- getConfigSchema(): ConfigUISchema;
23
- getClassMap(): ClassMapDefinition;
24
- getModelCatalog(): ModelCatalogEntry[];
25
- getAvailableModels(): DetectionModel[];
26
- getActiveLabels(): readonly LabelDefinition[];
27
- probe(): Promise<ProbeResult>;
28
- }
29
-
30
- export { AnimalClassifierAddon as default };
@@ -1,30 +0,0 @@
1
- import { IClassifierProvider, IDetectionAddon, AddonManifest, ModelRequirement, ResolvedInferenceConfig, AddonContext, CropInput, ClassifierOutput, ConfigUISchema, ClassMapDefinition, ModelCatalogEntry, DetectionModel, LabelDefinition, ProbeResult } from '@camstack/types';
2
-
3
- declare class AnimalClassifierAddon implements IClassifierProvider, IDetectionAddon {
4
- readonly id = "animal-classifier";
5
- readonly slot: "classifier";
6
- readonly inputClasses: readonly ["animal"];
7
- readonly outputClasses: readonly ["animal-type:*"];
8
- readonly slotPriority = 0;
9
- readonly requiredSteps: readonly [];
10
- readonly manifest: AddonManifest;
11
- private engine;
12
- private modelEntry;
13
- private minConfidence;
14
- private resolvedConfig;
15
- private ctx;
16
- getModelRequirements(): ModelRequirement[];
17
- configure(config: ResolvedInferenceConfig): void;
18
- initialize(ctx: AddonContext): Promise<void>;
19
- classify(input: CropInput): Promise<ClassifierOutput>;
20
- private ensureEngine;
21
- shutdown(): Promise<void>;
22
- getConfigSchema(): ConfigUISchema;
23
- getClassMap(): ClassMapDefinition;
24
- getModelCatalog(): ModelCatalogEntry[];
25
- getAvailableModels(): DetectionModel[];
26
- getActiveLabels(): readonly LabelDefinition[];
27
- probe(): Promise<ProbeResult>;
28
- }
29
-
30
- export { AnimalClassifierAddon as default };
@@ -1,36 +0,0 @@
1
- import { IClassifierProvider, IDetectionAddon, AddonManifest, ModelRequirement, ResolvedInferenceConfig, AddonContext, CropInput, ClassifierOutput, ConfigUISchema, ClassMapDefinition, ModelCatalogEntry, DetectionModel, LabelDefinition, ProbeResult } from '@camstack/types';
2
-
3
- declare class AudioClassificationAddon implements IClassifierProvider, IDetectionAddon {
4
- readonly id = "audio-classification";
5
- readonly slot: "classifier";
6
- readonly inputClasses: readonly string[] | null;
7
- readonly outputClasses: readonly ["audio-event:*"];
8
- readonly slotPriority = 0;
9
- readonly manifest: AddonManifest;
10
- private engine;
11
- private modelEntry;
12
- private minScore;
13
- private resolvedConfig;
14
- private ctx;
15
- getModelRequirements(): ModelRequirement[];
16
- configure(config: ResolvedInferenceConfig): void;
17
- initialize(ctx: AddonContext): Promise<void>;
18
- /**
19
- * classify() receives a CropInput but internally treats input.frame.data as raw audio context.
20
- * For audio, the actual audio chunk data should be stored in frame.data as a Float32Array
21
- * serialized into a Buffer (little-endian float32 samples at 16 kHz).
22
- *
23
- * The CropInput.roi is not used for audio — it is ignored.
24
- */
25
- classify(input: CropInput): Promise<ClassifierOutput>;
26
- private ensureEngine;
27
- shutdown(): Promise<void>;
28
- getConfigSchema(): ConfigUISchema;
29
- getClassMap(): ClassMapDefinition;
30
- getModelCatalog(): ModelCatalogEntry[];
31
- getAvailableModels(): DetectionModel[];
32
- getActiveLabels(): readonly LabelDefinition[];
33
- probe(): Promise<ProbeResult>;
34
- }
35
-
36
- export { AudioClassificationAddon as default };
@@ -1,36 +0,0 @@
1
- import { IClassifierProvider, IDetectionAddon, AddonManifest, ModelRequirement, ResolvedInferenceConfig, AddonContext, CropInput, ClassifierOutput, ConfigUISchema, ClassMapDefinition, ModelCatalogEntry, DetectionModel, LabelDefinition, ProbeResult } from '@camstack/types';
2
-
3
- declare class AudioClassificationAddon implements IClassifierProvider, IDetectionAddon {
4
- readonly id = "audio-classification";
5
- readonly slot: "classifier";
6
- readonly inputClasses: readonly string[] | null;
7
- readonly outputClasses: readonly ["audio-event:*"];
8
- readonly slotPriority = 0;
9
- readonly manifest: AddonManifest;
10
- private engine;
11
- private modelEntry;
12
- private minScore;
13
- private resolvedConfig;
14
- private ctx;
15
- getModelRequirements(): ModelRequirement[];
16
- configure(config: ResolvedInferenceConfig): void;
17
- initialize(ctx: AddonContext): Promise<void>;
18
- /**
19
- * classify() receives a CropInput but internally treats input.frame.data as raw audio context.
20
- * For audio, the actual audio chunk data should be stored in frame.data as a Float32Array
21
- * serialized into a Buffer (little-endian float32 samples at 16 kHz).
22
- *
23
- * The CropInput.roi is not used for audio — it is ignored.
24
- */
25
- classify(input: CropInput): Promise<ClassifierOutput>;
26
- private ensureEngine;
27
- shutdown(): Promise<void>;
28
- getConfigSchema(): ConfigUISchema;
29
- getClassMap(): ClassMapDefinition;
30
- getModelCatalog(): ModelCatalogEntry[];
31
- getAvailableModels(): DetectionModel[];
32
- getActiveLabels(): readonly LabelDefinition[];
33
- probe(): Promise<ProbeResult>;
34
- }
35
-
36
- export { AudioClassificationAddon as default };
@@ -1,31 +0,0 @@
1
- import { IClassifierProvider, IDetectionAddon, AddonManifest, ModelRequirement, ResolvedInferenceConfig, AddonContext, CropInput, ClassifierOutput, ConfigUISchema, ClassMapDefinition, ModelCatalogEntry, DetectionModel, LabelDefinition, ProbeResult } from '@camstack/types';
2
-
3
- declare class BirdGlobalClassifierAddon implements IClassifierProvider, IDetectionAddon {
4
- readonly id = "bird-global-classifier";
5
- readonly slot: "classifier";
6
- readonly inputClasses: readonly ["animal"];
7
- readonly outputClasses: readonly ["species:*"];
8
- readonly slotPriority = 0;
9
- readonly requiredSteps: readonly [];
10
- readonly manifest: AddonManifest;
11
- private engine;
12
- private modelEntry;
13
- private labels;
14
- private minConfidence;
15
- private resolvedConfig;
16
- private ctx;
17
- getModelRequirements(): ModelRequirement[];
18
- configure(config: ResolvedInferenceConfig): void;
19
- initialize(ctx: AddonContext): Promise<void>;
20
- classify(input: CropInput): Promise<ClassifierOutput>;
21
- private ensureEngine;
22
- shutdown(): Promise<void>;
23
- getConfigSchema(): ConfigUISchema;
24
- getClassMap(): ClassMapDefinition;
25
- getModelCatalog(): ModelCatalogEntry[];
26
- getAvailableModels(): DetectionModel[];
27
- getActiveLabels(): readonly LabelDefinition[];
28
- probe(): Promise<ProbeResult>;
29
- }
30
-
31
- export { BirdGlobalClassifierAddon as default };
@@ -1,31 +0,0 @@
1
- import { IClassifierProvider, IDetectionAddon, AddonManifest, ModelRequirement, ResolvedInferenceConfig, AddonContext, CropInput, ClassifierOutput, ConfigUISchema, ClassMapDefinition, ModelCatalogEntry, DetectionModel, LabelDefinition, ProbeResult } from '@camstack/types';
2
-
3
- declare class BirdGlobalClassifierAddon implements IClassifierProvider, IDetectionAddon {
4
- readonly id = "bird-global-classifier";
5
- readonly slot: "classifier";
6
- readonly inputClasses: readonly ["animal"];
7
- readonly outputClasses: readonly ["species:*"];
8
- readonly slotPriority = 0;
9
- readonly requiredSteps: readonly [];
10
- readonly manifest: AddonManifest;
11
- private engine;
12
- private modelEntry;
13
- private labels;
14
- private minConfidence;
15
- private resolvedConfig;
16
- private ctx;
17
- getModelRequirements(): ModelRequirement[];
18
- configure(config: ResolvedInferenceConfig): void;
19
- initialize(ctx: AddonContext): Promise<void>;
20
- classify(input: CropInput): Promise<ClassifierOutput>;
21
- private ensureEngine;
22
- shutdown(): Promise<void>;
23
- getConfigSchema(): ConfigUISchema;
24
- getClassMap(): ClassMapDefinition;
25
- getModelCatalog(): ModelCatalogEntry[];
26
- getAvailableModels(): DetectionModel[];
27
- getActiveLabels(): readonly LabelDefinition[];
28
- probe(): Promise<ProbeResult>;
29
- }
30
-
31
- export { BirdGlobalClassifierAddon as default };
@@ -1,33 +0,0 @@
1
- import { IClassifierProvider, IDetectionAddon, AddonManifest, ModelRequirement, ResolvedInferenceConfig, AddonContext, CropInput, ClassifierOutput, ConfigUISchema, ClassMapDefinition, ModelCatalogEntry, DetectionModel, LabelDefinition, ProbeResult } from '@camstack/types';
2
-
3
- declare class BirdNABirdsClassifierAddon implements IClassifierProvider, IDetectionAddon {
4
- readonly id = "bird-nabirds-classifier";
5
- readonly slot: "classifier";
6
- readonly inputClasses: readonly ["animal"];
7
- readonly outputClasses: readonly ["species:*"];
8
- readonly slotPriority = 0;
9
- readonly requiredSteps: readonly [];
10
- readonly manifest: AddonManifest;
11
- private engine;
12
- private modelEntry;
13
- private labels;
14
- private minConfidence;
15
- private allowedSpecies;
16
- private resolvedConfig;
17
- private ctx;
18
- getModelRequirements(): ModelRequirement[];
19
- configure(config: ResolvedInferenceConfig): void;
20
- initialize(ctx: AddonContext): Promise<void>;
21
- private applyRegionFilter;
22
- classify(input: CropInput): Promise<ClassifierOutput>;
23
- private ensureEngine;
24
- shutdown(): Promise<void>;
25
- getConfigSchema(): ConfigUISchema;
26
- getClassMap(): ClassMapDefinition;
27
- getModelCatalog(): ModelCatalogEntry[];
28
- getAvailableModels(): DetectionModel[];
29
- getActiveLabels(): readonly LabelDefinition[];
30
- probe(): Promise<ProbeResult>;
31
- }
32
-
33
- export { BirdNABirdsClassifierAddon as default };
@@ -1,33 +0,0 @@
1
- import { IClassifierProvider, IDetectionAddon, AddonManifest, ModelRequirement, ResolvedInferenceConfig, AddonContext, CropInput, ClassifierOutput, ConfigUISchema, ClassMapDefinition, ModelCatalogEntry, DetectionModel, LabelDefinition, ProbeResult } from '@camstack/types';
2
-
3
- declare class BirdNABirdsClassifierAddon implements IClassifierProvider, IDetectionAddon {
4
- readonly id = "bird-nabirds-classifier";
5
- readonly slot: "classifier";
6
- readonly inputClasses: readonly ["animal"];
7
- readonly outputClasses: readonly ["species:*"];
8
- readonly slotPriority = 0;
9
- readonly requiredSteps: readonly [];
10
- readonly manifest: AddonManifest;
11
- private engine;
12
- private modelEntry;
13
- private labels;
14
- private minConfidence;
15
- private allowedSpecies;
16
- private resolvedConfig;
17
- private ctx;
18
- getModelRequirements(): ModelRequirement[];
19
- configure(config: ResolvedInferenceConfig): void;
20
- initialize(ctx: AddonContext): Promise<void>;
21
- private applyRegionFilter;
22
- classify(input: CropInput): Promise<ClassifierOutput>;
23
- private ensureEngine;
24
- shutdown(): Promise<void>;
25
- getConfigSchema(): ConfigUISchema;
26
- getClassMap(): ClassMapDefinition;
27
- getModelCatalog(): ModelCatalogEntry[];
28
- getAvailableModels(): DetectionModel[];
29
- getActiveLabels(): readonly LabelDefinition[];
30
- probe(): Promise<ProbeResult>;
31
- }
32
-
33
- export { BirdNABirdsClassifierAddon as default };
@@ -1,29 +0,0 @@
1
- import { ICropperProvider, IDetectionAddon, AddonManifest, ModelRequirement, ResolvedInferenceConfig, AddonContext, CropInput, CropperOutput, ConfigUISchema, ClassMapDefinition, ModelCatalogEntry, DetectionModel, LabelDefinition, ProbeResult } from '@camstack/types';
2
-
3
- declare class FaceDetectionAddon implements ICropperProvider, IDetectionAddon {
4
- readonly id = "face-detection";
5
- readonly slot: "cropper";
6
- readonly inputClasses: readonly ["person"];
7
- readonly outputClasses: readonly ["face"];
8
- readonly slotPriority = 0;
9
- readonly manifest: AddonManifest;
10
- private engine;
11
- private modelEntry;
12
- private confidence;
13
- private resolvedConfig;
14
- private ctx;
15
- getModelRequirements(): ModelRequirement[];
16
- configure(config: ResolvedInferenceConfig): void;
17
- initialize(ctx: AddonContext): Promise<void>;
18
- crop(input: CropInput): Promise<CropperOutput>;
19
- private ensureEngine;
20
- shutdown(): Promise<void>;
21
- getConfigSchema(): ConfigUISchema;
22
- getClassMap(): ClassMapDefinition;
23
- getModelCatalog(): ModelCatalogEntry[];
24
- getAvailableModels(): DetectionModel[];
25
- getActiveLabels(): readonly LabelDefinition[];
26
- probe(): Promise<ProbeResult>;
27
- }
28
-
29
- export { FaceDetectionAddon as default };
@@ -1,29 +0,0 @@
1
- import { ICropperProvider, IDetectionAddon, AddonManifest, ModelRequirement, ResolvedInferenceConfig, AddonContext, CropInput, CropperOutput, ConfigUISchema, ClassMapDefinition, ModelCatalogEntry, DetectionModel, LabelDefinition, ProbeResult } from '@camstack/types';
2
-
3
- declare class FaceDetectionAddon implements ICropperProvider, IDetectionAddon {
4
- readonly id = "face-detection";
5
- readonly slot: "cropper";
6
- readonly inputClasses: readonly ["person"];
7
- readonly outputClasses: readonly ["face"];
8
- readonly slotPriority = 0;
9
- readonly manifest: AddonManifest;
10
- private engine;
11
- private modelEntry;
12
- private confidence;
13
- private resolvedConfig;
14
- private ctx;
15
- getModelRequirements(): ModelRequirement[];
16
- configure(config: ResolvedInferenceConfig): void;
17
- initialize(ctx: AddonContext): Promise<void>;
18
- crop(input: CropInput): Promise<CropperOutput>;
19
- private ensureEngine;
20
- shutdown(): Promise<void>;
21
- getConfigSchema(): ConfigUISchema;
22
- getClassMap(): ClassMapDefinition;
23
- getModelCatalog(): ModelCatalogEntry[];
24
- getAvailableModels(): DetectionModel[];
25
- getActiveLabels(): readonly LabelDefinition[];
26
- probe(): Promise<ProbeResult>;
27
- }
28
-
29
- export { FaceDetectionAddon as default };
@@ -1,29 +0,0 @@
1
- import { IClassifierProvider, IDetectionAddon, RequiredStep, AddonManifest, ModelRequirement, ResolvedInferenceConfig, AddonContext, CropInput, ClassifierOutput, ConfigUISchema, ClassMapDefinition, ModelCatalogEntry, DetectionModel, LabelDefinition, ProbeResult } from '@camstack/types';
2
-
3
- declare class FaceRecognitionAddon implements IClassifierProvider, IDetectionAddon {
4
- readonly id = "face-recognition";
5
- readonly slot: "classifier";
6
- readonly inputClasses: readonly ["face"];
7
- readonly outputClasses: readonly ["identity:*"];
8
- readonly slotPriority = 0;
9
- readonly requiredSteps: readonly RequiredStep[];
10
- readonly manifest: AddonManifest;
11
- private engine;
12
- private modelEntry;
13
- private resolvedConfig;
14
- private ctx;
15
- getModelRequirements(): ModelRequirement[];
16
- configure(config: ResolvedInferenceConfig): void;
17
- initialize(ctx: AddonContext): Promise<void>;
18
- classify(input: CropInput): Promise<ClassifierOutput>;
19
- private ensureEngine;
20
- shutdown(): Promise<void>;
21
- getConfigSchema(): ConfigUISchema;
22
- getClassMap(): ClassMapDefinition;
23
- getModelCatalog(): ModelCatalogEntry[];
24
- getAvailableModels(): DetectionModel[];
25
- getActiveLabels(): readonly LabelDefinition[];
26
- probe(): Promise<ProbeResult>;
27
- }
28
-
29
- export { FaceRecognitionAddon as default };
@@ -1,29 +0,0 @@
1
- import { IClassifierProvider, IDetectionAddon, RequiredStep, AddonManifest, ModelRequirement, ResolvedInferenceConfig, AddonContext, CropInput, ClassifierOutput, ConfigUISchema, ClassMapDefinition, ModelCatalogEntry, DetectionModel, LabelDefinition, ProbeResult } from '@camstack/types';
2
-
3
- declare class FaceRecognitionAddon implements IClassifierProvider, IDetectionAddon {
4
- readonly id = "face-recognition";
5
- readonly slot: "classifier";
6
- readonly inputClasses: readonly ["face"];
7
- readonly outputClasses: readonly ["identity:*"];
8
- readonly slotPriority = 0;
9
- readonly requiredSteps: readonly RequiredStep[];
10
- readonly manifest: AddonManifest;
11
- private engine;
12
- private modelEntry;
13
- private resolvedConfig;
14
- private ctx;
15
- getModelRequirements(): ModelRequirement[];
16
- configure(config: ResolvedInferenceConfig): void;
17
- initialize(ctx: AddonContext): Promise<void>;
18
- classify(input: CropInput): Promise<ClassifierOutput>;
19
- private ensureEngine;
20
- shutdown(): Promise<void>;
21
- getConfigSchema(): ConfigUISchema;
22
- getClassMap(): ClassMapDefinition;
23
- getModelCatalog(): ModelCatalogEntry[];
24
- getAvailableModels(): DetectionModel[];
25
- getActiveLabels(): readonly LabelDefinition[];
26
- probe(): Promise<ProbeResult>;
27
- }
28
-
29
- export { FaceRecognitionAddon as default };
@@ -1,28 +0,0 @@
1
- import { IDetectorProvider, IDetectionAddon, ModelRequirement, AddonManifest, AddonContext, FrameInput, DetectorOutput, ConfigUISchema, ClassMapDefinition, ModelCatalogEntry, DetectionModel, LabelDefinition, ProbeResult } from '@camstack/types';
2
-
3
- declare class MotionDetectionAddon implements IDetectorProvider, IDetectionAddon {
4
- readonly id = "motion-detection";
5
- readonly slot: "detector";
6
- readonly inputClasses: readonly string[] | null;
7
- readonly outputClasses: readonly ["motion"];
8
- readonly slotPriority = 10;
9
- /** Motion detection has no ML models — returns empty requirements */
10
- getModelRequirements(): ModelRequirement[];
11
- readonly manifest: AddonManifest;
12
- private previousGray;
13
- private previousWidth;
14
- private previousHeight;
15
- private threshold;
16
- private minArea;
17
- initialize(ctx: AddonContext): Promise<void>;
18
- detect(frame: FrameInput): Promise<DetectorOutput>;
19
- shutdown(): Promise<void>;
20
- getConfigSchema(): ConfigUISchema;
21
- getClassMap(): ClassMapDefinition;
22
- getModelCatalog(): ModelCatalogEntry[];
23
- getAvailableModels(): DetectionModel[];
24
- getActiveLabels(): readonly LabelDefinition[];
25
- probe(): Promise<ProbeResult>;
26
- }
27
-
28
- export { MotionDetectionAddon as default };
@@ -1,28 +0,0 @@
1
- import { IDetectorProvider, IDetectionAddon, ModelRequirement, AddonManifest, AddonContext, FrameInput, DetectorOutput, ConfigUISchema, ClassMapDefinition, ModelCatalogEntry, DetectionModel, LabelDefinition, ProbeResult } from '@camstack/types';
2
-
3
- declare class MotionDetectionAddon implements IDetectorProvider, IDetectionAddon {
4
- readonly id = "motion-detection";
5
- readonly slot: "detector";
6
- readonly inputClasses: readonly string[] | null;
7
- readonly outputClasses: readonly ["motion"];
8
- readonly slotPriority = 10;
9
- /** Motion detection has no ML models — returns empty requirements */
10
- getModelRequirements(): ModelRequirement[];
11
- readonly manifest: AddonManifest;
12
- private previousGray;
13
- private previousWidth;
14
- private previousHeight;
15
- private threshold;
16
- private minArea;
17
- initialize(ctx: AddonContext): Promise<void>;
18
- detect(frame: FrameInput): Promise<DetectorOutput>;
19
- shutdown(): Promise<void>;
20
- getConfigSchema(): ConfigUISchema;
21
- getClassMap(): ClassMapDefinition;
22
- getModelCatalog(): ModelCatalogEntry[];
23
- getAvailableModels(): DetectionModel[];
24
- getActiveLabels(): readonly LabelDefinition[];
25
- probe(): Promise<ProbeResult>;
26
- }
27
-
28
- export { MotionDetectionAddon as default };
@@ -1,31 +0,0 @@
1
- import { IDetectorProvider, IDetectionAddon, AddonManifest, ModelRequirement, ResolvedInferenceConfig, AddonContext, FrameInput, DetectorOutput, ConfigUISchema, ClassMapDefinition, ModelCatalogEntry, DetectionModel, LabelDefinition, ProbeResult } from '@camstack/types';
2
-
3
- declare class ObjectDetectionAddon implements IDetectorProvider, IDetectionAddon {
4
- readonly id = "object-detection";
5
- readonly slot: "detector";
6
- readonly inputClasses: readonly string[] | null;
7
- readonly outputClasses: readonly ["person", "vehicle", "animal"];
8
- readonly slotPriority = 0;
9
- readonly manifest: AddonManifest;
10
- private engine;
11
- private modelEntry;
12
- private confidence;
13
- private iouThreshold;
14
- private classMapMode;
15
- private resolvedConfig;
16
- private ctx;
17
- getModelRequirements(): ModelRequirement[];
18
- configure(config: ResolvedInferenceConfig): void;
19
- initialize(ctx: AddonContext): Promise<void>;
20
- detect(frame: FrameInput): Promise<DetectorOutput>;
21
- private ensureEngine;
22
- shutdown(): Promise<void>;
23
- getConfigSchema(): ConfigUISchema;
24
- getClassMap(): ClassMapDefinition;
25
- getModelCatalog(): ModelCatalogEntry[];
26
- getAvailableModels(): DetectionModel[];
27
- getActiveLabels(): readonly LabelDefinition[];
28
- probe(): Promise<ProbeResult>;
29
- }
30
-
31
- export { ObjectDetectionAddon as default };
@@ -1,31 +0,0 @@
1
- import { IDetectorProvider, IDetectionAddon, AddonManifest, ModelRequirement, ResolvedInferenceConfig, AddonContext, FrameInput, DetectorOutput, ConfigUISchema, ClassMapDefinition, ModelCatalogEntry, DetectionModel, LabelDefinition, ProbeResult } from '@camstack/types';
2
-
3
- declare class ObjectDetectionAddon implements IDetectorProvider, IDetectionAddon {
4
- readonly id = "object-detection";
5
- readonly slot: "detector";
6
- readonly inputClasses: readonly string[] | null;
7
- readonly outputClasses: readonly ["person", "vehicle", "animal"];
8
- readonly slotPriority = 0;
9
- readonly manifest: AddonManifest;
10
- private engine;
11
- private modelEntry;
12
- private confidence;
13
- private iouThreshold;
14
- private classMapMode;
15
- private resolvedConfig;
16
- private ctx;
17
- getModelRequirements(): ModelRequirement[];
18
- configure(config: ResolvedInferenceConfig): void;
19
- initialize(ctx: AddonContext): Promise<void>;
20
- detect(frame: FrameInput): Promise<DetectorOutput>;
21
- private ensureEngine;
22
- shutdown(): Promise<void>;
23
- getConfigSchema(): ConfigUISchema;
24
- getClassMap(): ClassMapDefinition;
25
- getModelCatalog(): ModelCatalogEntry[];
26
- getAvailableModels(): DetectionModel[];
27
- getActiveLabels(): readonly LabelDefinition[];
28
- probe(): Promise<ProbeResult>;
29
- }
30
-
31
- export { ObjectDetectionAddon as default };
@@ -1,30 +0,0 @@
1
- import { ICropperProvider, IDetectionAddon, AddonManifest, ModelRequirement, ResolvedInferenceConfig, AddonContext, CropInput, CropperOutput, ConfigUISchema, ClassMapDefinition, ModelCatalogEntry, DetectionModel, LabelDefinition, ProbeResult } from '@camstack/types';
2
-
3
- declare class PlateDetectionAddon implements ICropperProvider, IDetectionAddon {
4
- readonly id = "plate-detection";
5
- readonly slot: "cropper";
6
- readonly inputClasses: readonly ["vehicle"];
7
- readonly outputClasses: readonly ["plate"];
8
- readonly slotPriority = 0;
9
- readonly manifest: AddonManifest;
10
- private engine;
11
- private modelEntry;
12
- private confidence;
13
- private iouThreshold;
14
- private resolvedConfig;
15
- private ctx;
16
- getModelRequirements(): ModelRequirement[];
17
- configure(config: ResolvedInferenceConfig): void;
18
- initialize(ctx: AddonContext): Promise<void>;
19
- crop(input: CropInput): Promise<CropperOutput>;
20
- private ensureEngine;
21
- shutdown(): Promise<void>;
22
- getConfigSchema(): ConfigUISchema;
23
- getClassMap(): ClassMapDefinition;
24
- getModelCatalog(): ModelCatalogEntry[];
25
- getAvailableModels(): DetectionModel[];
26
- getActiveLabels(): readonly LabelDefinition[];
27
- probe(): Promise<ProbeResult>;
28
- }
29
-
30
- export { PlateDetectionAddon as default };
@@ -1,30 +0,0 @@
1
- import { ICropperProvider, IDetectionAddon, AddonManifest, ModelRequirement, ResolvedInferenceConfig, AddonContext, CropInput, CropperOutput, ConfigUISchema, ClassMapDefinition, ModelCatalogEntry, DetectionModel, LabelDefinition, ProbeResult } from '@camstack/types';
2
-
3
- declare class PlateDetectionAddon implements ICropperProvider, IDetectionAddon {
4
- readonly id = "plate-detection";
5
- readonly slot: "cropper";
6
- readonly inputClasses: readonly ["vehicle"];
7
- readonly outputClasses: readonly ["plate"];
8
- readonly slotPriority = 0;
9
- readonly manifest: AddonManifest;
10
- private engine;
11
- private modelEntry;
12
- private confidence;
13
- private iouThreshold;
14
- private resolvedConfig;
15
- private ctx;
16
- getModelRequirements(): ModelRequirement[];
17
- configure(config: ResolvedInferenceConfig): void;
18
- initialize(ctx: AddonContext): Promise<void>;
19
- crop(input: CropInput): Promise<CropperOutput>;
20
- private ensureEngine;
21
- shutdown(): Promise<void>;
22
- getConfigSchema(): ConfigUISchema;
23
- getClassMap(): ClassMapDefinition;
24
- getModelCatalog(): ModelCatalogEntry[];
25
- getAvailableModels(): DetectionModel[];
26
- getActiveLabels(): readonly LabelDefinition[];
27
- probe(): Promise<ProbeResult>;
28
- }
29
-
30
- export { PlateDetectionAddon as default };
@@ -1,31 +0,0 @@
1
- import { IClassifierProvider, IDetectionAddon, RequiredStep, AddonManifest, ModelRequirement, ResolvedInferenceConfig, AddonContext, CropInput, ClassifierOutput, ConfigUISchema, ClassMapDefinition, ModelCatalogEntry, DetectionModel, LabelDefinition, ProbeResult } from '@camstack/types';
2
-
3
- declare class PlateRecognitionAddon implements IClassifierProvider, IDetectionAddon {
4
- readonly id = "plate-recognition";
5
- readonly slot: "classifier";
6
- readonly inputClasses: readonly ["plate"];
7
- readonly outputClasses: readonly ["plate-text:*"];
8
- readonly slotPriority = 0;
9
- readonly requiredSteps: readonly RequiredStep[];
10
- readonly manifest: AddonManifest;
11
- private engine;
12
- private modelEntry;
13
- private minConfidence;
14
- private charset;
15
- private resolvedConfig;
16
- private ctx;
17
- getModelRequirements(): ModelRequirement[];
18
- configure(config: ResolvedInferenceConfig): void;
19
- initialize(ctx: AddonContext): Promise<void>;
20
- classify(input: CropInput): Promise<ClassifierOutput>;
21
- private ensureEngine;
22
- shutdown(): Promise<void>;
23
- getConfigSchema(): ConfigUISchema;
24
- getClassMap(): ClassMapDefinition;
25
- getModelCatalog(): ModelCatalogEntry[];
26
- getAvailableModels(): DetectionModel[];
27
- getActiveLabels(): readonly LabelDefinition[];
28
- probe(): Promise<ProbeResult>;
29
- }
30
-
31
- export { PlateRecognitionAddon as default };
@@ -1,31 +0,0 @@
1
- import { IClassifierProvider, IDetectionAddon, RequiredStep, AddonManifest, ModelRequirement, ResolvedInferenceConfig, AddonContext, CropInput, ClassifierOutput, ConfigUISchema, ClassMapDefinition, ModelCatalogEntry, DetectionModel, LabelDefinition, ProbeResult } from '@camstack/types';
2
-
3
- declare class PlateRecognitionAddon implements IClassifierProvider, IDetectionAddon {
4
- readonly id = "plate-recognition";
5
- readonly slot: "classifier";
6
- readonly inputClasses: readonly ["plate"];
7
- readonly outputClasses: readonly ["plate-text:*"];
8
- readonly slotPriority = 0;
9
- readonly requiredSteps: readonly RequiredStep[];
10
- readonly manifest: AddonManifest;
11
- private engine;
12
- private modelEntry;
13
- private minConfidence;
14
- private charset;
15
- private resolvedConfig;
16
- private ctx;
17
- getModelRequirements(): ModelRequirement[];
18
- configure(config: ResolvedInferenceConfig): void;
19
- initialize(ctx: AddonContext): Promise<void>;
20
- classify(input: CropInput): Promise<ClassifierOutput>;
21
- private ensureEngine;
22
- shutdown(): Promise<void>;
23
- getConfigSchema(): ConfigUISchema;
24
- getClassMap(): ClassMapDefinition;
25
- getModelCatalog(): ModelCatalogEntry[];
26
- getAvailableModels(): DetectionModel[];
27
- getActiveLabels(): readonly LabelDefinition[];
28
- probe(): Promise<ProbeResult>;
29
- }
30
-
31
- export { PlateRecognitionAddon as default };
@@ -1,30 +0,0 @@
1
- import { IRefinerProvider, IDetectionAddon, AddonManifest, ModelRequirement, ResolvedInferenceConfig, AddonContext, CropInput, RefinerOutput, ConfigUISchema, ClassMapDefinition, ModelCatalogEntry, DetectionModel, LabelDefinition, ProbeResult } from '@camstack/types';
2
-
3
- declare class SegmentationRefinerAddon implements IRefinerProvider, IDetectionAddon {
4
- readonly id = "segmentation-refiner";
5
- readonly slot: "refiner";
6
- readonly inputClasses: null;
7
- readonly outputClasses: readonly ["mask:*"];
8
- readonly slotPriority = 0;
9
- readonly requiredSteps: readonly [];
10
- readonly manifest: AddonManifest;
11
- private engine;
12
- private modelEntry;
13
- private maskThreshold;
14
- private resolvedConfig;
15
- private ctx;
16
- getModelRequirements(): ModelRequirement[];
17
- configure(config: ResolvedInferenceConfig): void;
18
- initialize(ctx: AddonContext): Promise<void>;
19
- refine(input: CropInput): Promise<RefinerOutput>;
20
- private ensureEngine;
21
- shutdown(): Promise<void>;
22
- getConfigSchema(): ConfigUISchema;
23
- getClassMap(): ClassMapDefinition;
24
- getModelCatalog(): ModelCatalogEntry[];
25
- getAvailableModels(): DetectionModel[];
26
- getActiveLabels(): readonly LabelDefinition[];
27
- probe(): Promise<ProbeResult>;
28
- }
29
-
30
- export { SegmentationRefinerAddon as default };
@@ -1,30 +0,0 @@
1
- import { IRefinerProvider, IDetectionAddon, AddonManifest, ModelRequirement, ResolvedInferenceConfig, AddonContext, CropInput, RefinerOutput, ConfigUISchema, ClassMapDefinition, ModelCatalogEntry, DetectionModel, LabelDefinition, ProbeResult } from '@camstack/types';
2
-
3
- declare class SegmentationRefinerAddon implements IRefinerProvider, IDetectionAddon {
4
- readonly id = "segmentation-refiner";
5
- readonly slot: "refiner";
6
- readonly inputClasses: null;
7
- readonly outputClasses: readonly ["mask:*"];
8
- readonly slotPriority = 0;
9
- readonly requiredSteps: readonly [];
10
- readonly manifest: AddonManifest;
11
- private engine;
12
- private modelEntry;
13
- private maskThreshold;
14
- private resolvedConfig;
15
- private ctx;
16
- getModelRequirements(): ModelRequirement[];
17
- configure(config: ResolvedInferenceConfig): void;
18
- initialize(ctx: AddonContext): Promise<void>;
19
- refine(input: CropInput): Promise<RefinerOutput>;
20
- private ensureEngine;
21
- shutdown(): Promise<void>;
22
- getConfigSchema(): ConfigUISchema;
23
- getClassMap(): ClassMapDefinition;
24
- getModelCatalog(): ModelCatalogEntry[];
25
- getAvailableModels(): DetectionModel[];
26
- getActiveLabels(): readonly LabelDefinition[];
27
- probe(): Promise<ProbeResult>;
28
- }
29
-
30
- export { SegmentationRefinerAddon as default };
@@ -1,31 +0,0 @@
1
- import { IClassifierProvider, IDetectionAddon, AddonManifest, ModelRequirement, ResolvedInferenceConfig, AddonContext, CropInput, ClassifierOutput, ConfigUISchema, ClassMapDefinition, ModelCatalogEntry, DetectionModel, LabelDefinition, ProbeResult } from '@camstack/types';
2
-
3
- declare class VehicleClassifierAddon implements IClassifierProvider, IDetectionAddon {
4
- readonly id = "vehicle-classifier";
5
- readonly slot: "classifier";
6
- readonly inputClasses: readonly ["vehicle"];
7
- readonly outputClasses: readonly ["vehicle-type:*"];
8
- readonly slotPriority = 0;
9
- readonly requiredSteps: readonly [];
10
- readonly manifest: AddonManifest;
11
- private engine;
12
- private modelEntry;
13
- private labels;
14
- private minConfidence;
15
- private resolvedConfig;
16
- private ctx;
17
- getModelRequirements(): ModelRequirement[];
18
- configure(config: ResolvedInferenceConfig): void;
19
- initialize(ctx: AddonContext): Promise<void>;
20
- classify(input: CropInput): Promise<ClassifierOutput>;
21
- private ensureEngine;
22
- shutdown(): Promise<void>;
23
- getConfigSchema(): ConfigUISchema;
24
- getClassMap(): ClassMapDefinition;
25
- getModelCatalog(): ModelCatalogEntry[];
26
- getAvailableModels(): DetectionModel[];
27
- getActiveLabels(): readonly LabelDefinition[];
28
- probe(): Promise<ProbeResult>;
29
- }
30
-
31
- export { VehicleClassifierAddon as default };
@@ -1,31 +0,0 @@
1
- import { IClassifierProvider, IDetectionAddon, AddonManifest, ModelRequirement, ResolvedInferenceConfig, AddonContext, CropInput, ClassifierOutput, ConfigUISchema, ClassMapDefinition, ModelCatalogEntry, DetectionModel, LabelDefinition, ProbeResult } from '@camstack/types';
2
-
3
- declare class VehicleClassifierAddon implements IClassifierProvider, IDetectionAddon {
4
- readonly id = "vehicle-classifier";
5
- readonly slot: "classifier";
6
- readonly inputClasses: readonly ["vehicle"];
7
- readonly outputClasses: readonly ["vehicle-type:*"];
8
- readonly slotPriority = 0;
9
- readonly requiredSteps: readonly [];
10
- readonly manifest: AddonManifest;
11
- private engine;
12
- private modelEntry;
13
- private labels;
14
- private minConfidence;
15
- private resolvedConfig;
16
- private ctx;
17
- getModelRequirements(): ModelRequirement[];
18
- configure(config: ResolvedInferenceConfig): void;
19
- initialize(ctx: AddonContext): Promise<void>;
20
- classify(input: CropInput): Promise<ClassifierOutput>;
21
- private ensureEngine;
22
- shutdown(): Promise<void>;
23
- getConfigSchema(): ConfigUISchema;
24
- getClassMap(): ClassMapDefinition;
25
- getModelCatalog(): ModelCatalogEntry[];
26
- getAvailableModels(): DetectionModel[];
27
- getActiveLabels(): readonly LabelDefinition[];
28
- probe(): Promise<ProbeResult>;
29
- }
30
-
31
- export { VehicleClassifierAddon as default };
package/dist/index.d.mts DELETED
@@ -1,183 +0,0 @@
1
- import { BoundingBox, SpatialDetection, IInferenceEngine, DetectionRuntime, DetectionDevice, ModelCatalogEntry, IAddonModelManager, ModelFormat } from '@camstack/types';
2
- export { default as ObjectDetectionAddon } from './addons/object-detection/index.mjs';
3
- export { default as FaceDetectionAddon } from './addons/face-detection/index.mjs';
4
- export { default as FaceRecognitionAddon } from './addons/face-recognition/index.mjs';
5
- export { default as PlateDetectionAddon } from './addons/plate-detection/index.mjs';
6
- export { default as PlateRecognitionAddon } from './addons/plate-recognition/index.mjs';
7
- export { default as AudioClassificationAddon } from './addons/audio-classification/index.mjs';
8
- export { default as BirdGlobalClassifierAddon } from './addons/bird-global-classifier/index.mjs';
9
- export { default as BirdNABirdsClassifierAddon } from './addons/bird-nabirds-classifier/index.mjs';
10
- export { default as AnimalClassifierAddon } from './addons/animal-classifier/index.mjs';
11
-
12
- /** Decode JPEG to raw RGB pixels */
13
- declare function jpegToRgb(jpeg: Buffer): Promise<{
14
- data: Buffer;
15
- width: number;
16
- height: number;
17
- }>;
18
- /** Crop a region from a JPEG buffer */
19
- declare function cropRegion(jpeg: Buffer, roi: BoundingBox): Promise<Buffer>;
20
- /** Letterbox resize for YOLO: resize preserving aspect ratio, pad to square */
21
- declare function letterbox(jpeg: Buffer, targetSize: number): Promise<{
22
- data: Float32Array;
23
- scale: number;
24
- padX: number;
25
- padY: number;
26
- originalWidth: number;
27
- originalHeight: number;
28
- }>;
29
- /** Resize and normalize to Float32Array */
30
- declare function resizeAndNormalize(jpeg: Buffer, targetWidth: number, targetHeight: number, normalization: 'zero-one' | 'imagenet' | 'none', layout: 'nchw' | 'nhwc'): Promise<Float32Array>;
31
- /** Convert raw RGB to grayscale Uint8Array */
32
- declare function rgbToGrayscale(rgb: Buffer, width: number, height: number): Uint8Array;
33
-
34
- interface YoloPostprocessOptions {
35
- readonly confidence: number;
36
- readonly iouThreshold: number;
37
- readonly labels: readonly string[];
38
- readonly scale: number;
39
- readonly padX: number;
40
- readonly padY: number;
41
- readonly originalWidth: number;
42
- readonly originalHeight: number;
43
- }
44
- /** Calculate IoU between two bounding boxes */
45
- declare function iou(a: BoundingBox, b: BoundingBox): number;
46
- /** Non-maximum suppression — returns indices of kept boxes (sorted by score desc) */
47
- declare function nms(boxes: ReadonlyArray<{
48
- readonly bbox: BoundingBox;
49
- readonly score: number;
50
- }>, iouThreshold: number): number[];
51
- /** Full YOLO v8/v9 postprocessing: filter → NMS → scale back to original coords */
52
- declare function yoloPostprocess(output: Float32Array, numClasses: number, numBoxes: number, options: YoloPostprocessOptions): SpatialDetection[];
53
-
54
- interface ScrfdRawOutputs {
55
- readonly [key: string]: Float32Array;
56
- }
57
- declare function scrfdPostprocess(outputs: ScrfdRawOutputs, confidence: number, inputSize: number, originalWidth: number, originalHeight: number): SpatialDetection[];
58
-
59
- /** L2 normalize a vector in-place, returning a new Float32Array */
60
- declare function l2Normalize(vec: Float32Array): Float32Array;
61
- /** Cosine similarity between two embeddings (assumes they are already L2-normalized) */
62
- declare function cosineSimilarity(a: Float32Array, b: Float32Array): number;
63
-
64
- /** Decode CTC output to text.
65
- *
66
- * Output shape: [1, seqLen, numChars]
67
- * Algorithm: argmax per timestep → collapse consecutive duplicates → remove blank (index 0) → join
68
- */
69
- declare function ctcDecode(output: Float32Array, seqLen: number, numChars: number, charset: readonly string[]): {
70
- text: string;
71
- confidence: number;
72
- };
73
-
74
- interface AudioClassification {
75
- readonly className: string;
76
- readonly score: number;
77
- }
78
- /** Average YAMNET scores across frames, return top classes above threshold */
79
- declare function yamnetPostprocess(output: Float32Array, numFrames: number, numClasses: number, classNames: readonly string[], minScore: number): AudioClassification[];
80
-
81
- declare class NodeInferenceEngine implements IInferenceEngine {
82
- private readonly modelPath;
83
- private readonly backend;
84
- readonly runtime: DetectionRuntime;
85
- readonly device: DetectionDevice;
86
- private session;
87
- constructor(modelPath: string, backend: string);
88
- initialize(): Promise<void>;
89
- run(input: Float32Array, inputShape: readonly number[]): Promise<Float32Array>;
90
- runMultiOutput(input: Float32Array, inputShape: readonly number[]): Promise<Record<string, Float32Array>>;
91
- dispose(): Promise<void>;
92
- }
93
-
94
- declare class PythonInferenceEngine implements IInferenceEngine {
95
- private readonly pythonPath;
96
- private readonly scriptPath;
97
- private readonly modelPath;
98
- private readonly extraArgs;
99
- readonly runtime: DetectionRuntime;
100
- readonly device: DetectionDevice;
101
- private process;
102
- private receiveBuffer;
103
- private pendingResolve;
104
- private pendingReject;
105
- constructor(pythonPath: string, scriptPath: string, runtime: DetectionRuntime, modelPath: string, extraArgs?: readonly string[]);
106
- initialize(): Promise<void>;
107
- private _tryReceive;
108
- /** Send JPEG buffer, receive JSON detection results */
109
- runJpeg(jpeg: Buffer): Promise<Record<string, unknown>>;
110
- /** IInferenceEngine.run — wraps runJpeg for compatibility */
111
- run(_input: Float32Array, _inputShape: readonly number[]): Promise<Float32Array>;
112
- /** IInferenceEngine.runMultiOutput — not supported by Python engine (operates on JPEG input) */
113
- runMultiOutput(_input: Float32Array, _inputShape: readonly number[]): Promise<Record<string, Float32Array>>;
114
- dispose(): Promise<void>;
115
- }
116
-
117
- interface EngineResolverOptions {
118
- readonly runtime: DetectionRuntime | 'auto';
119
- readonly backend: string;
120
- readonly modelEntry: ModelCatalogEntry;
121
- readonly modelsDir: string;
122
- readonly pythonPath?: string;
123
- /** Model service for downloading models. When provided, used instead of raw filesystem probing. */
124
- readonly models?: IAddonModelManager;
125
- }
126
- interface ResolvedEngine {
127
- readonly engine: IInferenceEngine;
128
- readonly format: ModelFormat;
129
- readonly modelPath: string;
130
- }
131
- declare function resolveEngine(options: EngineResolverOptions): Promise<ResolvedEngine>;
132
- /** Probe which ONNX execution providers are available on this system */
133
- declare function probeOnnxBackends(): Promise<string[]>;
134
-
135
- interface MotionRegion {
136
- readonly bbox: BoundingBox;
137
- readonly pixelCount: number;
138
- readonly intensity: number;
139
- }
140
- /**
141
- * Detect motion by frame differencing.
142
- *
143
- * @param current - Grayscale pixel array for the current frame (Uint8Array, length = width * height)
144
- * @param previous - Grayscale pixel array for the previous frame
145
- * @param width - Frame width in pixels
146
- * @param height - Frame height in pixels
147
- * @param threshold - Pixel diff threshold 0-255; differences below this are ignored
148
- * @param minArea - Minimum number of changed pixels for a region to be reported
149
- */
150
- declare function detectMotion(current: Uint8Array, previous: Uint8Array, width: number, height: number, threshold: number, minArea: number): MotionRegion[];
151
-
152
- /** Standard files inside every .mlpackage directory bundle */
153
- declare const MLPACKAGE_FILES: readonly ["Manifest.json", "Data/com.apple.CoreML/model.mlmodel", "Data/com.apple.CoreML/weights/weight.bin"];
154
- declare const OBJECT_DETECTION_MODELS: readonly ModelCatalogEntry[];
155
-
156
- declare const FACE_DETECTION_MODELS: readonly ModelCatalogEntry[];
157
-
158
- declare const FACE_RECOGNITION_MODELS: readonly ModelCatalogEntry[];
159
-
160
- declare const PLATE_DETECTION_MODELS: readonly ModelCatalogEntry[];
161
-
162
- declare const PLATE_RECOGNITION_MODELS: readonly ModelCatalogEntry[];
163
-
164
- /**
165
- * General-purpose OCR models for scene text recognition in camera feeds.
166
- * These complement the plate-specific PaddleOCR models for broader text detection
167
- * (signs, labels, addresses, etc.).
168
- */
169
- declare const GENERAL_OCR_MODELS: readonly ModelCatalogEntry[];
170
-
171
- declare const AUDIO_CLASSIFICATION_MODELS: readonly ModelCatalogEntry[];
172
-
173
- declare const SEGMENTATION_MODELS: readonly ModelCatalogEntry[];
174
-
175
- declare const BIRD_SPECIES_MODELS: readonly ModelCatalogEntry[];
176
- declare const BIRD_NABIRDS_MODELS: readonly ModelCatalogEntry[];
177
- declare const ANIMAL_TYPE_MODELS: readonly ModelCatalogEntry[];
178
-
179
- declare const VEHICLE_TYPE_MODELS: readonly ModelCatalogEntry[];
180
-
181
- declare const SEGMENTATION_REFINER_MODELS: readonly ModelCatalogEntry[];
182
-
183
- export { ANIMAL_TYPE_MODELS, AUDIO_CLASSIFICATION_MODELS, BIRD_NABIRDS_MODELS, BIRD_SPECIES_MODELS, type EngineResolverOptions, FACE_DETECTION_MODELS, FACE_RECOGNITION_MODELS, GENERAL_OCR_MODELS, MLPACKAGE_FILES, type MotionRegion, NodeInferenceEngine, OBJECT_DETECTION_MODELS, PLATE_DETECTION_MODELS, PLATE_RECOGNITION_MODELS, PythonInferenceEngine, type ResolvedEngine, SEGMENTATION_MODELS, SEGMENTATION_REFINER_MODELS, VEHICLE_TYPE_MODELS, cosineSimilarity, cropRegion, ctcDecode, detectMotion, iou, jpegToRgb, l2Normalize, letterbox, nms, probeOnnxBackends, resizeAndNormalize, resolveEngine, rgbToGrayscale, scrfdPostprocess, yamnetPostprocess, yoloPostprocess };
package/dist/index.d.ts DELETED
@@ -1,183 +0,0 @@
1
- import { BoundingBox, SpatialDetection, IInferenceEngine, DetectionRuntime, DetectionDevice, ModelCatalogEntry, IAddonModelManager, ModelFormat } from '@camstack/types';
2
- export { default as ObjectDetectionAddon } from './addons/object-detection/index.js';
3
- export { default as FaceDetectionAddon } from './addons/face-detection/index.js';
4
- export { default as FaceRecognitionAddon } from './addons/face-recognition/index.js';
5
- export { default as PlateDetectionAddon } from './addons/plate-detection/index.js';
6
- export { default as PlateRecognitionAddon } from './addons/plate-recognition/index.js';
7
- export { default as AudioClassificationAddon } from './addons/audio-classification/index.js';
8
- export { default as BirdGlobalClassifierAddon } from './addons/bird-global-classifier/index.js';
9
- export { default as BirdNABirdsClassifierAddon } from './addons/bird-nabirds-classifier/index.js';
10
- export { default as AnimalClassifierAddon } from './addons/animal-classifier/index.js';
11
-
12
- /** Decode JPEG to raw RGB pixels */
13
- declare function jpegToRgb(jpeg: Buffer): Promise<{
14
- data: Buffer;
15
- width: number;
16
- height: number;
17
- }>;
18
- /** Crop a region from a JPEG buffer */
19
- declare function cropRegion(jpeg: Buffer, roi: BoundingBox): Promise<Buffer>;
20
- /** Letterbox resize for YOLO: resize preserving aspect ratio, pad to square */
21
- declare function letterbox(jpeg: Buffer, targetSize: number): Promise<{
22
- data: Float32Array;
23
- scale: number;
24
- padX: number;
25
- padY: number;
26
- originalWidth: number;
27
- originalHeight: number;
28
- }>;
29
- /** Resize and normalize to Float32Array */
30
- declare function resizeAndNormalize(jpeg: Buffer, targetWidth: number, targetHeight: number, normalization: 'zero-one' | 'imagenet' | 'none', layout: 'nchw' | 'nhwc'): Promise<Float32Array>;
31
- /** Convert raw RGB to grayscale Uint8Array */
32
- declare function rgbToGrayscale(rgb: Buffer, width: number, height: number): Uint8Array;
33
-
34
- interface YoloPostprocessOptions {
35
- readonly confidence: number;
36
- readonly iouThreshold: number;
37
- readonly labels: readonly string[];
38
- readonly scale: number;
39
- readonly padX: number;
40
- readonly padY: number;
41
- readonly originalWidth: number;
42
- readonly originalHeight: number;
43
- }
44
- /** Calculate IoU between two bounding boxes */
45
- declare function iou(a: BoundingBox, b: BoundingBox): number;
46
- /** Non-maximum suppression — returns indices of kept boxes (sorted by score desc) */
47
- declare function nms(boxes: ReadonlyArray<{
48
- readonly bbox: BoundingBox;
49
- readonly score: number;
50
- }>, iouThreshold: number): number[];
51
- /** Full YOLO v8/v9 postprocessing: filter → NMS → scale back to original coords */
52
- declare function yoloPostprocess(output: Float32Array, numClasses: number, numBoxes: number, options: YoloPostprocessOptions): SpatialDetection[];
53
-
54
- interface ScrfdRawOutputs {
55
- readonly [key: string]: Float32Array;
56
- }
57
- declare function scrfdPostprocess(outputs: ScrfdRawOutputs, confidence: number, inputSize: number, originalWidth: number, originalHeight: number): SpatialDetection[];
58
-
59
- /** L2 normalize a vector in-place, returning a new Float32Array */
60
- declare function l2Normalize(vec: Float32Array): Float32Array;
61
- /** Cosine similarity between two embeddings (assumes they are already L2-normalized) */
62
- declare function cosineSimilarity(a: Float32Array, b: Float32Array): number;
63
-
64
- /** Decode CTC output to text.
65
- *
66
- * Output shape: [1, seqLen, numChars]
67
- * Algorithm: argmax per timestep → collapse consecutive duplicates → remove blank (index 0) → join
68
- */
69
- declare function ctcDecode(output: Float32Array, seqLen: number, numChars: number, charset: readonly string[]): {
70
- text: string;
71
- confidence: number;
72
- };
73
-
74
- interface AudioClassification {
75
- readonly className: string;
76
- readonly score: number;
77
- }
78
- /** Average YAMNET scores across frames, return top classes above threshold */
79
- declare function yamnetPostprocess(output: Float32Array, numFrames: number, numClasses: number, classNames: readonly string[], minScore: number): AudioClassification[];
80
-
81
- declare class NodeInferenceEngine implements IInferenceEngine {
82
- private readonly modelPath;
83
- private readonly backend;
84
- readonly runtime: DetectionRuntime;
85
- readonly device: DetectionDevice;
86
- private session;
87
- constructor(modelPath: string, backend: string);
88
- initialize(): Promise<void>;
89
- run(input: Float32Array, inputShape: readonly number[]): Promise<Float32Array>;
90
- runMultiOutput(input: Float32Array, inputShape: readonly number[]): Promise<Record<string, Float32Array>>;
91
- dispose(): Promise<void>;
92
- }
93
-
94
- declare class PythonInferenceEngine implements IInferenceEngine {
95
- private readonly pythonPath;
96
- private readonly scriptPath;
97
- private readonly modelPath;
98
- private readonly extraArgs;
99
- readonly runtime: DetectionRuntime;
100
- readonly device: DetectionDevice;
101
- private process;
102
- private receiveBuffer;
103
- private pendingResolve;
104
- private pendingReject;
105
- constructor(pythonPath: string, scriptPath: string, runtime: DetectionRuntime, modelPath: string, extraArgs?: readonly string[]);
106
- initialize(): Promise<void>;
107
- private _tryReceive;
108
- /** Send JPEG buffer, receive JSON detection results */
109
- runJpeg(jpeg: Buffer): Promise<Record<string, unknown>>;
110
- /** IInferenceEngine.run — wraps runJpeg for compatibility */
111
- run(_input: Float32Array, _inputShape: readonly number[]): Promise<Float32Array>;
112
- /** IInferenceEngine.runMultiOutput — not supported by Python engine (operates on JPEG input) */
113
- runMultiOutput(_input: Float32Array, _inputShape: readonly number[]): Promise<Record<string, Float32Array>>;
114
- dispose(): Promise<void>;
115
- }
116
-
117
- interface EngineResolverOptions {
118
- readonly runtime: DetectionRuntime | 'auto';
119
- readonly backend: string;
120
- readonly modelEntry: ModelCatalogEntry;
121
- readonly modelsDir: string;
122
- readonly pythonPath?: string;
123
- /** Model service for downloading models. When provided, used instead of raw filesystem probing. */
124
- readonly models?: IAddonModelManager;
125
- }
126
- interface ResolvedEngine {
127
- readonly engine: IInferenceEngine;
128
- readonly format: ModelFormat;
129
- readonly modelPath: string;
130
- }
131
- declare function resolveEngine(options: EngineResolverOptions): Promise<ResolvedEngine>;
132
- /** Probe which ONNX execution providers are available on this system */
133
- declare function probeOnnxBackends(): Promise<string[]>;
134
-
135
- interface MotionRegion {
136
- readonly bbox: BoundingBox;
137
- readonly pixelCount: number;
138
- readonly intensity: number;
139
- }
140
- /**
141
- * Detect motion by frame differencing.
142
- *
143
- * @param current - Grayscale pixel array for the current frame (Uint8Array, length = width * height)
144
- * @param previous - Grayscale pixel array for the previous frame
145
- * @param width - Frame width in pixels
146
- * @param height - Frame height in pixels
147
- * @param threshold - Pixel diff threshold 0-255; differences below this are ignored
148
- * @param minArea - Minimum number of changed pixels for a region to be reported
149
- */
150
- declare function detectMotion(current: Uint8Array, previous: Uint8Array, width: number, height: number, threshold: number, minArea: number): MotionRegion[];
151
-
152
- /** Standard files inside every .mlpackage directory bundle */
153
- declare const MLPACKAGE_FILES: readonly ["Manifest.json", "Data/com.apple.CoreML/model.mlmodel", "Data/com.apple.CoreML/weights/weight.bin"];
154
- declare const OBJECT_DETECTION_MODELS: readonly ModelCatalogEntry[];
155
-
156
- declare const FACE_DETECTION_MODELS: readonly ModelCatalogEntry[];
157
-
158
- declare const FACE_RECOGNITION_MODELS: readonly ModelCatalogEntry[];
159
-
160
- declare const PLATE_DETECTION_MODELS: readonly ModelCatalogEntry[];
161
-
162
- declare const PLATE_RECOGNITION_MODELS: readonly ModelCatalogEntry[];
163
-
164
- /**
165
- * General-purpose OCR models for scene text recognition in camera feeds.
166
- * These complement the plate-specific PaddleOCR models for broader text detection
167
- * (signs, labels, addresses, etc.).
168
- */
169
- declare const GENERAL_OCR_MODELS: readonly ModelCatalogEntry[];
170
-
171
- declare const AUDIO_CLASSIFICATION_MODELS: readonly ModelCatalogEntry[];
172
-
173
- declare const SEGMENTATION_MODELS: readonly ModelCatalogEntry[];
174
-
175
- declare const BIRD_SPECIES_MODELS: readonly ModelCatalogEntry[];
176
- declare const BIRD_NABIRDS_MODELS: readonly ModelCatalogEntry[];
177
- declare const ANIMAL_TYPE_MODELS: readonly ModelCatalogEntry[];
178
-
179
- declare const VEHICLE_TYPE_MODELS: readonly ModelCatalogEntry[];
180
-
181
- declare const SEGMENTATION_REFINER_MODELS: readonly ModelCatalogEntry[];
182
-
183
- export { ANIMAL_TYPE_MODELS, AUDIO_CLASSIFICATION_MODELS, BIRD_NABIRDS_MODELS, BIRD_SPECIES_MODELS, type EngineResolverOptions, FACE_DETECTION_MODELS, FACE_RECOGNITION_MODELS, GENERAL_OCR_MODELS, MLPACKAGE_FILES, type MotionRegion, NodeInferenceEngine, OBJECT_DETECTION_MODELS, PLATE_DETECTION_MODELS, PLATE_RECOGNITION_MODELS, PythonInferenceEngine, type ResolvedEngine, SEGMENTATION_MODELS, SEGMENTATION_REFINER_MODELS, VEHICLE_TYPE_MODELS, cosineSimilarity, cropRegion, ctcDecode, detectMotion, iou, jpegToRgb, l2Normalize, letterbox, nms, probeOnnxBackends, resizeAndNormalize, resolveEngine, rgbToGrayscale, scrfdPostprocess, yamnetPostprocess, yoloPostprocess };