From 2383f161126dadf3af496fed2ae7246e98ba00da Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Fri, 7 Apr 2023 14:53:27 -0700 Subject: [PATCH] videoanalysis: improve logging for debugging --- plugins/objectdetector/package-lock.json | 4 ++-- plugins/objectdetector/package.json | 2 +- plugins/objectdetector/src/main.ts | 18 ++++++++++++++++++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/plugins/objectdetector/package-lock.json b/plugins/objectdetector/package-lock.json index 0454e36fd..d913a5fb3 100644 --- a/plugins/objectdetector/package-lock.json +++ b/plugins/objectdetector/package-lock.json @@ -1,12 +1,12 @@ { "name": "@scrypted/objectdetector", - "version": "0.0.122", + "version": "0.0.123", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@scrypted/objectdetector", - "version": "0.0.122", + "version": "0.0.123", "license": "Apache-2.0", "dependencies": { "@scrypted/common": "file:../../common", diff --git a/plugins/objectdetector/package.json b/plugins/objectdetector/package.json index d8f635c47..42a0dddef 100644 --- a/plugins/objectdetector/package.json +++ b/plugins/objectdetector/package.json @@ -1,6 +1,6 @@ { "name": "@scrypted/objectdetector", - "version": "0.0.122", + "version": "0.0.123", "description": "Scrypted Video Analysis Plugin. Installed alongside a detection service like OpenCV or TensorFlow.", "author": "Scrypted", "license": "Apache-2.0", diff --git a/plugins/objectdetector/src/main.ts b/plugins/objectdetector/src/main.ts index f81b581e6..32900db4f 100644 --- a/plugins/objectdetector/src/main.ts +++ b/plugins/objectdetector/src/main.ts @@ -327,6 +327,8 @@ class ObjectDetectionMixin extends SettingsMixinDeviceBase(); + let lastReport = 0; try { for await (const detected of await this.objectDetection.generateObjectDetections(await generator(), { @@ -348,6 +350,22 @@ class ObjectDetectionMixin extends SettingsMixinDeviceBase lastReport + 3000) { + const found = [...currentDetections.values()]; + if (!found.length) + found.push('[no detections]'); + this.console.log(`[${Math.round((now - start) / 100) / 10}s] Detected:`, ...found); + currentDetections.clear(); + lastReport = now; + } + } + if (detected.detected.detectionId) { const jpeg = await detected.videoFrame.toBuffer({ format: 'jpg',