From ea6e33d159a22276eb0f7bc625997cec59faab46 Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Sun, 11 Jun 2023 09:13:05 -0700 Subject: [PATCH] videoanalysis: prevent snapshot throttling when its only a single camera --- plugins/objectdetector/package-lock.json | 4 ++-- plugins/objectdetector/package.json | 2 +- plugins/objectdetector/src/main.ts | 4 ++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/plugins/objectdetector/package-lock.json b/plugins/objectdetector/package-lock.json index 29ccaba35..d216953a6 100644 --- a/plugins/objectdetector/package-lock.json +++ b/plugins/objectdetector/package-lock.json @@ -1,12 +1,12 @@ { "name": "@scrypted/objectdetector", - "version": "0.0.141", + "version": "0.0.142", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@scrypted/objectdetector", - "version": "0.0.141", + "version": "0.0.142", "license": "Apache-2.0", "dependencies": { "@scrypted/common": "file:../../common", diff --git a/plugins/objectdetector/package.json b/plugins/objectdetector/package.json index f46beb08d..0feae1240 100644 --- a/plugins/objectdetector/package.json +++ b/plugins/objectdetector/package.json @@ -1,6 +1,6 @@ { "name": "@scrypted/objectdetector", - "version": "0.0.141", + "version": "0.0.142", "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 9f131cc84..581911211 100644 --- a/plugins/objectdetector/src/main.ts +++ b/plugins/objectdetector/src/main.ts @@ -991,6 +991,10 @@ class ObjectDetectionPlugin extends AutoenableMixinProvider implements Settings, shouldUseSnapshotPipeline() { this.pruneOldStatistics(); + // never use snapshot mode if its a single camera. + if (this.statsSnapshotConcurrent < 2) + return false; + // find any concurrent cameras with as many or more that had passable results for (const [k, v] of this.objectDetectionStatistics.entries()) { if (v.dps > 2 && k >= this.statsSnapshotConcurrent)