NVR with realtime local object detection for IP cameras
TypeScript aicameragoogle-coralhome-assistanthome-automationhomeautomationmqttnvrobject-detectionrealtimertsptensorflow
Fix genai (#22203)
Nicolas Mowen720e949feffc
diff --git a/frigate/data_processing/post/object_descriptions.py b/frigate/data_processing/post/object_descriptions.pyindex cdb5f4fc37..266ede316b 100644--- a/frigate/data_processing/post/object_descriptions.py+++ b/frigate/data_processing/post/object_descriptions.py@@ -103,16 +103,19 @@ class ObjectDescriptionProcessor(PostProcessorApi):logger.debug(f"{camera} sending early request to GenAI")self.early_request_sent[data["id"]] = True+ # Copy thumbnails to avoid holding references after cleanup+ thumbnails_copy = [+ data["thumbnail"][:] if data.get("thumbnail") else None+ for data in self.tracked_events[data["id"]]+ if data.get("thumbnail")+ ]threading.Thread(target=self._genai_embed_description,name=f"_genai_embed_description_{event.id}",daemon=True,args=(event,- [- data["thumbnail"]- for data in self.tracked_events[data["id"]]- ],+ thumbnails_copy,),).start()@@ -172,8 +175,13 @@ class ObjectDescriptionProcessor(PostProcessorApi):embed_image = ([snapshot_image]if event.has_snapshot and source == "snapshot"+ # Copy thumbnails to avoid holding referenceselse (- [data["thumbnail"] for data in self.tracked_events[event_id]]+ [+ data["thumbnail"][:] if data.get("thumbnail") else None+ for data in self.tracked_events[event_id]+ if data.get("thumbnail")+ ]if len(self.tracked_events.get(event_id, [])) > 0else [thumbnail])@@ -276,8 +284,13 @@ class ObjectDescriptionProcessor(PostProcessorApi):embed_image = ([snapshot_image]if event.has_snapshot and camera_config.objects.genai.use_snapshot+ # Copy thumbnails to avoid holding references after cleanupelse (- [data["thumbnail"] for data in self.tracked_events[event.id]]+ [+ data["thumbnail"][:] if data.get("thumbnail") else None+ for data in self.tracked_events[event.id]+ if data.get("thumbnail")+ ]if num_thumbnails > 0else [thumbnail])diff --git a/frigate/embeddings/maintainer.py b/frigate/embeddings/maintainer.pyindex bd707de15f..b632951d92 100644--- a/frigate/embeddings/maintainer.py+++ b/frigate/embeddings/maintainer.py@@ -679,4 +679,7 @@ class EmbeddingMaintainer(threading.Thread):if not self.config.semantic_search.enabled:return- self.embeddings.embed_thumbnail(event_id, thumbnail)+ try:+ self.embeddings.embed_thumbnail(event_id, thumbnail)+ except ValueError:+ logger.warning(f"Failed to embed thumbnail for event {event_id}")