From f96b301fe921e381fa8633501e0846570b1e745a Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Sun, 30 Mar 2025 06:48:48 -0500 Subject: [PATCH] ensure we always have a color --- frigate/camera/state.py | 8 ++++++-- frigate/track/tracked_object.py | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/frigate/camera/state.py b/frigate/camera/state.py index 65a3dcf5d..267c7d457 100644 --- a/frigate/camera/state.py +++ b/frigate/camera/state.py @@ -88,7 +88,9 @@ class CameraState: thickness = 1 else: thickness = 2 - color = self.config.model.colormap[obj["label"]] + color = self.config.model.colormap.get( + obj["label"], (255, 255, 255) + ) else: thickness = 1 color = (255, 0, 0) @@ -110,7 +112,9 @@ class CameraState: and obj["frame_time"] == frame_time ): thickness = 5 - color = self.config.model.colormap[obj["label"]] + color = self.config.model.colormap.get( + obj["label"], (255, 255, 255) + ) # debug autotracking zooming - show the zoom factor box if ( diff --git a/frigate/track/tracked_object.py b/frigate/track/tracked_object.py index 7a4829c2a..978671512 100644 --- a/frigate/track/tracked_object.py +++ b/frigate/track/tracked_object.py @@ -442,7 +442,7 @@ class TrackedObject: if bounding_box: thickness = 2 - color = self.colormap[self.obj_data["label"]] + color = self.colormap.get(self.obj_data["label"], (255, 255, 255)) # draw the bounding boxes on the frame box = self.thumbnail_data["box"]