From 560dc68120aa2cc1be5d67e54e96c12973172a7f Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Mon, 21 Oct 2024 08:38:48 -0600 Subject: [PATCH] Fixes (#14480) * Catch case where object does not have thumbnail data * Catch intel stats json decoding error * Catch division by zero --- frigate/object_processing.py | 1 + frigate/util/services.py | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/frigate/object_processing.py b/frigate/object_processing.py index 7ba3270f1..fab7bbc6c 100644 --- a/frigate/object_processing.py +++ b/frigate/object_processing.py @@ -344,6 +344,7 @@ class CameraState: # if the object's thumbnail is not from the current frame, skip if ( current_frame is None + or obj.thumbnail_data is None or obj.false_positive or obj.thumbnail_data["frame_time"] != frame_time ): diff --git a/frigate/util/services.py b/frigate/util/services.py index 925ca6be8..3f8ecf32c 100644 --- a/frigate/util/services.py +++ b/frigate/util/services.py @@ -279,7 +279,11 @@ def get_intel_gpu_stats() -> dict[str, str]: logger.error(f"Unable to poll intel GPU stats: {p.stderr}") return None else: - data = json.loads(f'[{"".join(p.stdout.split())}]') + try: + data = json.loads(f'[{"".join(p.stdout.split())}]') + except json.JSONDecodeError: + return {"gpu": "-%", "mem": "-%"} + results: dict[str, str] = {} render = {"global": []} video = {"global": []} @@ -328,7 +332,7 @@ def get_intel_gpu_stats() -> dict[str, str]: results["clients"] = {} for key in render.keys(): - if key == "global": + if key == "global" or not render[key] or not video[key]: continue results["clients"][key] = (