UNPKG

@the-horizon-dev/fast-face-detection

Version:

Fast face detection package using TensorFlow.js MediaPipe models for browser and Node.js environments

50 lines (49 loc) 1.35 kB
/** * Base detector class for face detection */ import { DetectionOptions } from '../types/types'; import { Environment } from '../types/types'; /** * Abstract base class for all detectors */ export declare abstract class BaseDetector { /** Flag indicating if the detector has been disposed */ protected isDisposed: boolean; /** Current execution environment */ protected environment: Environment; /** Detection configuration options */ protected options: DetectionOptions; /** * Creates a new detector instance with configuration options * @param options Configuration options for the detector */ constructor(options?: DetectionOptions); /** * Ensures TensorFlow backend is initialized */ protected ensureTensorflowBackend(): Promise<void>; /** * Updates detector options */ updateOptions(options: DetectionOptions): void; /** * Called when options are updated */ protected abstract onOptionsUpdated(): void; /** * Releases all resources */ dispose(): void; /** * Handles resource disposal */ protected abstract onDispose(): void; /** * Pre-loads model for later use */ warmup(): Promise<void>; /** * Handles model warmup */ protected abstract onWarmup(): Promise<void>; }