@camstack/addon-scene-intelligence 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/addon.js +447 -0
- package/dist/addon.js.map +1 -0
- package/dist/addon.mjs +7 -0
- package/dist/addon.mjs.map +1 -0
- package/dist/chunk-KKV7JX7G.mjs +479 -0
- package/dist/chunk-KKV7JX7G.mjs.map +1 -0
- package/dist/index.js +3 -3
- package/dist/index.mjs +12 -465
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
- package/dist/index.d.mts +0 -87
- package/dist/index.d.ts +0 -87
package/dist/index.d.ts
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { ICamstackAddon, ISceneIntelligence, AddonManifest, AddonContext, CapabilityProviderMap, CropInput, ClassifierOutput, EmbeddingMetadata, EmbeddingFilter, VectorSearchResult, SceneStateResult, IScopedLogger, IEmbeddingsBackend, ModelCatalogEntry } from '@camstack/types';
|
|
2
|
-
|
|
3
|
-
declare class SceneIntelligenceAddon implements ICamstackAddon, ISceneIntelligence {
|
|
4
|
-
readonly manifest: AddonManifest;
|
|
5
|
-
private logger;
|
|
6
|
-
private imageEncoder;
|
|
7
|
-
private textEncoder;
|
|
8
|
-
private sceneStateMachine;
|
|
9
|
-
private referenceStore;
|
|
10
|
-
private searchService;
|
|
11
|
-
private ctx;
|
|
12
|
-
initialize(context: AddonContext): Promise<void>;
|
|
13
|
-
shutdown(): Promise<void>;
|
|
14
|
-
getCapabilityProvider<K extends keyof CapabilityProviderMap>(name: K): CapabilityProviderMap[K] | null;
|
|
15
|
-
classify(input: CropInput): Promise<ClassifierOutput>;
|
|
16
|
-
embed(deviceId: string, crop: Buffer, metadata: EmbeddingMetadata): Promise<string>;
|
|
17
|
-
search(query: string, topK: number, filter?: EmbeddingFilter): Promise<VectorSearchResult[]>;
|
|
18
|
-
searchByImage(image: Buffer, topK: number, filter?: EmbeddingFilter): Promise<VectorSearchResult[]>;
|
|
19
|
-
evaluateSceneState(deviceId: string, crop: Buffer): Promise<SceneStateResult | null>;
|
|
20
|
-
private ensureTextEncoder;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
declare class ClipImageEncoder {
|
|
24
|
-
private session;
|
|
25
|
-
private readonly modelId;
|
|
26
|
-
private readonly inputSize;
|
|
27
|
-
private readonly logger;
|
|
28
|
-
constructor(modelId: string, logger: IScopedLogger);
|
|
29
|
-
load(modelPath: string): Promise<void>;
|
|
30
|
-
/**
|
|
31
|
-
* Encode a raw RGB buffer into a CLIP embedding.
|
|
32
|
-
* Caller must provide RGB buffer (use sharp to decode JPEG first).
|
|
33
|
-
*/
|
|
34
|
-
encode(rgb: Buffer, width: number, height: number): Promise<Float32Array>;
|
|
35
|
-
dispose(): Promise<void>;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
declare class ClipTextEncoder {
|
|
39
|
-
private session;
|
|
40
|
-
private readonly logger;
|
|
41
|
-
constructor(logger: IScopedLogger);
|
|
42
|
-
load(modelPath: string): Promise<void>;
|
|
43
|
-
encode(text: string): Promise<Float32Array>;
|
|
44
|
-
dispose(): Promise<void>;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
declare class SearchService {
|
|
48
|
-
private readonly backend;
|
|
49
|
-
private index;
|
|
50
|
-
constructor(backend: IEmbeddingsBackend);
|
|
51
|
-
initialize(): Promise<void>;
|
|
52
|
-
storeEmbedding(id: string, embedding: Float32Array, metadata: EmbeddingMetadata): Promise<void>;
|
|
53
|
-
searchByVector(query: Float32Array, topK: number, filter?: EmbeddingFilter): Promise<readonly VectorSearchResult[]>;
|
|
54
|
-
count(): Promise<number>;
|
|
55
|
-
shutdown(): Promise<void>;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
interface SceneStateDefinition {
|
|
59
|
-
readonly id: string;
|
|
60
|
-
readonly name: string;
|
|
61
|
-
readonly referenceEmbedding: Float32Array;
|
|
62
|
-
readonly threshold: number;
|
|
63
|
-
}
|
|
64
|
-
declare class SceneStateMachine {
|
|
65
|
-
private readonly debounceFrames;
|
|
66
|
-
private readonly cameraStates;
|
|
67
|
-
constructor(debounceFrames?: number);
|
|
68
|
-
evaluate(deviceId: string, embedding: Float32Array, referenceStates: readonly SceneStateDefinition[]): SceneStateResult | null;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
declare const CLIP_MODELS: readonly ModelCatalogEntry[];
|
|
72
|
-
declare const DEFAULT_CLIP_MODEL = "mobileclip-s0";
|
|
73
|
-
declare const CLIP_EMBEDDING_DIM = 512;
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Preprocess raw RGB buffer for CLIP inference.
|
|
77
|
-
* Resizes (nearest-neighbor for speed), normalizes with CLIP mean/std, outputs NCHW Float32Array.
|
|
78
|
-
* For production use, the caller should use sharp to resize the JPEG to targetW×targetH
|
|
79
|
-
* before calling this with the raw RGB. This function handles normalization + layout.
|
|
80
|
-
*/
|
|
81
|
-
declare function preprocessForClip(rgb: Buffer, srcWidth: number, srcHeight: number, targetWidth: number, targetHeight: number): Float32Array;
|
|
82
|
-
/**
|
|
83
|
-
* L2-normalize a vector in-place and return it.
|
|
84
|
-
*/
|
|
85
|
-
declare function l2Normalize(vec: Float32Array): Float32Array;
|
|
86
|
-
|
|
87
|
-
export { CLIP_EMBEDDING_DIM, CLIP_MODELS, ClipImageEncoder, ClipTextEncoder, DEFAULT_CLIP_MODEL, SceneIntelligenceAddon, SceneStateMachine, SearchService, SceneIntelligenceAddon as default, l2Normalize, preprocessForClip };
|