From fa6989cdbb846f6aa63305c92c0375a8afcc7f52 Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Thu, 20 Jan 2022 21:19:23 -0800 Subject: [PATCH] videoanalysis: stream watchdog --- plugins/objectdetector/package-lock.json | 4 ++-- plugins/objectdetector/package.json | 2 +- plugins/objectdetector/src/main.ts | 1 + plugins/opencv/package-lock.json | 4 ++-- plugins/opencv/package.json | 2 +- plugins/tensorflow-lite/package-lock.json | 4 ++-- plugins/tensorflow-lite/package.json | 2 +- plugins/tensorflow-lite/src/detect/__init__.py | 7 +++++++ 8 files changed, 17 insertions(+), 9 deletions(-) diff --git a/plugins/objectdetector/package-lock.json b/plugins/objectdetector/package-lock.json index 477c8ee1a..33a457d57 100644 --- a/plugins/objectdetector/package-lock.json +++ b/plugins/objectdetector/package-lock.json @@ -1,12 +1,12 @@ { "name": "@scrypted/objectdetector", - "version": "0.0.40", + "version": "0.0.41", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@scrypted/objectdetector", - "version": "0.0.40", + "version": "0.0.41", "license": "Apache-2.0", "dependencies": { "@scrypted/common": "file:../../common", diff --git a/plugins/objectdetector/package.json b/plugins/objectdetector/package.json index b312ee250..de7532051 100644 --- a/plugins/objectdetector/package.json +++ b/plugins/objectdetector/package.json @@ -1,6 +1,6 @@ { "name": "@scrypted/objectdetector", - "version": "0.0.40", + "version": "0.0.41", "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 a67ae1d6e..236915e29 100644 --- a/plugins/objectdetector/src/main.ts +++ b/plugins/objectdetector/src/main.ts @@ -236,6 +236,7 @@ class ObjectDetectionMixin extends SettingsMixinDeviceBase 30: + print('detection session has not received a sample in 30 seconds, terminating', detection_session.id) + ending = True + if ending: if detection_session: self.end_session(detection_session) @@ -303,6 +308,8 @@ class DetectPlugin(scrypted_sdk.ScryptedDeviceBase, ObjectDetection): first_frame = True def user_callback(gst_sample, src_size, convert_to_src_size): try: + detection_session.last_sample = time.time() + nonlocal first_frame if first_frame: first_frame = False