Update build process

This commit is contained in:
2025-09-30 15:48:26 -06:00
parent bff35c285b
commit e411213826
10 changed files with 67 additions and 80 deletions

View File

@@ -6,7 +6,7 @@ import { skuIdentificationService } from '../sku-identification';
// Extend window interface for TensorFlow.js
declare global {
interface Window {
tf: any;
tf: unknown;
}
}
@@ -16,12 +16,13 @@ declare global {
export class DetectionEngine {
private workerManager: DetectionWorkerManager;
private config: DetectionConfig;
private model: any = null; // TensorFlow.js model instance
private model: unknown = null; // TensorFlow.js model instance
// Detection state
private isRunning = false;
private detectionMode: DetectionMode = 'hybrid';
private frameSkipCounter = 0;
private detectionCount = 0;
// Temporal filtering
private detectionHistory: DetectionResult[] = [];
@@ -31,10 +32,7 @@ export class DetectionEngine {
private metrics: DetectionMetrics = {
fps: 0,
inferenceTime: 0,
memoryUsage: 0,
detectionCount: 0,
falsePositiveRate: 0,
timestamp: Date.now()
memoryUsage: 0
};
// Event callbacks
@@ -133,8 +131,6 @@ export class DetectionEngine {
// Update metrics
this.metrics.inferenceTime = performance.now() - startTime;
this.metrics.detectionCount++;
this.metrics.timestamp = Date.now();
console.log('✅ Trigger detection completed:', detection);
@@ -196,8 +192,8 @@ export class DetectionEngine {
this.frameSkipCounter = 0;
// Only log every 10th detection to reduce noise
if (this.metrics.detectionCount % 10 === 0) {
console.log(`🔄 Continuous detection running... (${this.metrics.detectionCount} inferences)`);
if (this.detectionCount % 10 === 0) {
console.log(`🔄 Continuous detection running... (${this.detectionCount} inferences)`);
}
try {
@@ -312,15 +308,13 @@ export class DetectionEngine {
* Update performance metrics
*/
private updateMetrics(inferenceTime: number): void {
this.detectionCount++;
this.metrics = {
fps: 0, // Placeholder, as PerformanceMonitor is removed
inferenceTime: inferenceTime,
memoryUsage: this.getMemoryUsage(),
detectionCount: this.metrics.detectionCount + 1,
falsePositiveRate: this.calculateFalsePositiveRate(),
timestamp: Date.now()
memoryUsage: this.getMemoryUsage()
};
if (this.onMetricsCallback) {
this.onMetricsCallback(this.metrics);
}
@@ -339,13 +333,6 @@ export class DetectionEngine {
return 0;
}
/**
* Calculate false positive rate (simplified)
*/
private calculateFalsePositiveRate(): number {
// This would need more sophisticated tracking in a real implementation
return Math.max(0, Math.min(1, this.detectionHistory.length > 10 ? 0.1 : 0.05));
}
/**
* Set detection callback