UNPKG

@nodify_at/hailo.js

Version:

High-performance Node.js bindings for Hailo AI acceleration processors (NPU). Run neural network inference with hardware acceleration on Hailo-8 devices.

80 lines (79 loc) 2.08 kB
/** * HailoDevice - High-level wrapper for Hailo AI inference * Provides a clean, type-safe interface with performance monitoring */ import { EventEmitter } from 'events'; import { InferenceInputs, InferenceOutputs, ModelInfo, DeviceOptions, ModelConfig } from './types.js'; /** * High-level Hailo device interface with enhanced functionality * * @example * ```typescript * const device = new HailoDevice(); * await device.loadModel({ * type: ModelType.YOLOV8, * path: './models/yolov8n.hef', * numClasses: 80 * }); * * const output = await device.infer(inputTensor); * ``` */ export declare class HailoDevice extends EventEmitter { private device; private modelConfig?; private performanceBuffer; private readonly options; constructor(options?: DeviceOptions); /** * Load a model with configuration * Supports automatic model type detection from filename */ loadModel(config: ModelConfig | string): Promise<void>; /** * Run inference with performance tracking */ infer(inputs: InferenceInputs): Promise<InferenceOutputs>; /** * Get model information */ getModelInfo(): ModelInfo; /** * Check if device is ready for inference */ isReady(): boolean; /** * Get average performance metrics */ getPerformanceStats(): { avgInferenceTime: number; avgFps: number; minInferenceTime: number; maxInferenceTime: number; }; /** * Reset performance tracking */ resetPerformanceStats(): void; /** * Get current model configuration */ getModelConfig(): ModelConfig | undefined; /** * Detect model configuration from filename */ private detectModelConfig; /** * Track performance metrics with sliding window */ private trackPerformance; /** * Static method to scan for available devices */ static scanDevices(): Promise<string[]>; /** * Get addon version */ static get version(): string; } export * from './types.js';