From a374a607568e6d086b3a4c31291dec1684a103eb Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Sun, 9 Nov 2025 07:38:38 -0700 Subject: [PATCH] Miscellaneous Fixes (#20850) * Fix wrongly added detection objects to alert * Fix CudaGraph inverse condition * Add debug logs * Formatting --- .../real_time/custom_classification.py | 6 ++++++ frigate/detectors/detection_runners.py | 2 +- frigate/review/maintainer.py | 13 +++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/frigate/data_processing/real_time/custom_classification.py b/frigate/data_processing/real_time/custom_classification.py index 7d0975712..45ec30338 100644 --- a/frigate/data_processing/real_time/custom_classification.py +++ b/frigate/data_processing/real_time/custom_classification.py @@ -227,6 +227,9 @@ class CustomStateClassificationProcessor(RealTimeProcessorApi): self.tensor_output_details[0]["index"] )[0] probs = res / res.sum(axis=0) + logger.debug( + f"{self.model_config.name} Ran state classification with probabilities: {probs}" + ) best_id = np.argmax(probs) score = round(probs[best_id], 2) self.__update_metrics(datetime.datetime.now().timestamp() - now) @@ -455,6 +458,9 @@ class CustomObjectClassificationProcessor(RealTimeProcessorApi): self.tensor_output_details[0]["index"] )[0] probs = res / res.sum(axis=0) + logger.debug( + f"{self.model_config.name} Ran object classification with probabilities: {probs}" + ) best_id = np.argmax(probs) score = round(probs[best_id], 2) self.__update_metrics(datetime.datetime.now().timestamp() - now) diff --git a/frigate/detectors/detection_runners.py b/frigate/detectors/detection_runners.py index 5cadb3d52..6eb3a32fc 100644 --- a/frigate/detectors/detection_runners.py +++ b/frigate/detectors/detection_runners.py @@ -529,7 +529,7 @@ def get_optimized_runner( return OpenVINOModelRunner(model_path, device, model_type, **kwargs) if ( - not CudaGraphRunner.is_model_supported(model_type) + CudaGraphRunner.is_model_supported(model_type) and providers[0] == "CUDAExecutionProvider" ): options[0] = { diff --git a/frigate/review/maintainer.py b/frigate/review/maintainer.py index 40d7b64cf..917c0c5ac 100644 --- a/frigate/review/maintainer.py +++ b/frigate/review/maintainer.py @@ -407,6 +407,19 @@ class ReviewSegmentMaintainer(threading.Thread): segment.last_detection_time = frame_time for object in activity.get_all_objects(): + # Alert-level objects should always be added (they extend/upgrade the segment) + # Detection-level objects should only be added if: + # - The segment is a detection segment (matching severity), OR + # - The segment is an alert AND the object started before the alert ended + # (objects starting after will be in the new detection segment) + is_alert_object = object in activity.categorized_objects["alerts"] + + if not is_alert_object and segment.severity == SeverityEnum.alert: + # This is a detection-level object + # Only add if it started during the alert's active period + if object["start_time"] > segment.last_alert_time: + continue + if not object["sub_label"]: segment.detections[object["id"]] = object["label"] elif object["sub_label"][0] in self.config.model.all_attributes: