From 834cd10f99b50ebe0da94ad3e8a6753bd7cf8de1 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Wed, 13 Aug 2025 07:43:14 -0600 Subject: [PATCH] Cleanup --- .../post/review_descriptions.py | 4 +++- frigate/genai/__init__.py | 18 ++---------------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/frigate/data_processing/post/review_descriptions.py b/frigate/data_processing/post/review_descriptions.py index 6a6127e00..68496fc18 100644 --- a/frigate/data_processing/post/review_descriptions.py +++ b/frigate/data_processing/post/review_descriptions.py @@ -209,7 +209,9 @@ def run_analysis( { "id": final_data["id"], "camera": camera, - "objects": final_data["data"]["objects"], + "objects": list( + filter(lambda o: "-verified" not in o, final_data["data"]["objects"]) + ), "recognized_objects": final_data["data"]["sub_labels"], "zones": final_data["data"]["zones"], "timestamp": datetime.datetime.fromtimestamp(final_data["end_time"]), diff --git a/frigate/genai/__init__.py b/frigate/genai/__init__.py index 83bb289c2..ba936db3c 100644 --- a/frigate/genai/__init__.py +++ b/frigate/genai/__init__.py @@ -52,23 +52,10 @@ class GenAIClient: concern_list = "\n - ".join(concerns) return f""" - `other_concerns` (list of strings): Include a list of any of the following concerns that are occurring: - - {concern_list} -""" + - {concern_list}""" else: return "" - def get_recognized_objects_prompt() -> str: - if not review_data["recognized_objects"]: - return "" - - return f""" -Recognized Objects: -- These are people, vehicles, or other entities that the system has positively identified. -- Always use these names or labels directly in the scene description instead of generic terms. - -Recognized objects: {list(set(review_data["recognized_objects"]))} -""" - def get_language_prompt() -> str: if preferred_language: return f"Provide your answer in {preferred_language}" @@ -91,8 +78,6 @@ When forming your description: - Focus on behaviors that are uncharacteristic of innocent activity: loitering without clear purpose, avoiding cameras, inspecting vehicles/doors, changing behavior when lights activate, scanning surroundings without an apparent benign reason. - **Benign context override**: If scanning or looking around is clearly part of an innocent activity (such as playing with a dog, gardening, supervising children, or watching for a pet), do not treat it as suspicious. -{get_recognized_objects_prompt()} - Your response MUST be a flat JSON object with: - `scene` (string): A full description including setting, entities, actions, and any plausible supported inferences. - `confidence` (float): 0-1 confidence in the analysis. @@ -108,6 +93,7 @@ Sequence details: - Frame 1 = earliest, Frame 10 = latest - Activity occurred at {review_data["timestamp"].strftime("%I:%M %p")} - Detected objects: {list(set(review_data["objects"]))} +- Recognized objects: {list(set(review_data["recognized_objects"])) or "None"} - Zones involved: {review_data["zones"]} **IMPORTANT:**