Improve detection saving

This commit is contained in:
Nicolas Mowen 2025-08-31 09:07:38 -06:00
parent a12063e19d
commit 5b8b096c13

View File

@ -479,17 +479,19 @@ class ReviewSegmentMaintainer(threading.Thread):
and (segment.last_detection_time + THRESHOLD_DETECTION_ACTIVITY) and (segment.last_detection_time + THRESHOLD_DETECTION_ACTIVITY)
> frame_time > frame_time
) )
last_detection_time = segment.last_detection_time
end_time = self._publish_segment_end(segment, prev_data) end_time = self._publish_segment_end(segment, prev_data)
if needs_new_detection: if needs_new_detection:
new_detections = {} new_detections: dict[str, str] = {}
new_zones = set() new_zones = set()
for o in activity.categorized_objects["detections"]: for o in activity.categorized_objects["detections"]:
new_detections[o["id"]] = o["label"] new_detections[o["id"]] = o["label"]
new_zones.update(o["current_zones"]) new_zones.update(o["current_zones"])
if new_detections:
self.active_review_segments[activity.camera_config.name] = ( self.active_review_segments[activity.camera_config.name] = (
PendingReviewSegment( PendingReviewSegment(
activity.camera_config.name, activity.camera_config.name,
@ -504,6 +506,9 @@ class ReviewSegmentMaintainer(threading.Thread):
self._publish_segment_start( self._publish_segment_start(
self.active_review_segments[activity.camera_config.name] self.active_review_segments[activity.camera_config.name]
) )
self.active_review_segments[
activity.camera_config.name
].last_detection_time = last_detection_time
elif segment.severity == SeverityEnum.detection and frame_time > ( elif segment.severity == SeverityEnum.detection and frame_time > (
segment.last_detection_time + THRESHOLD_DETECTION_ACTIVITY segment.last_detection_time + THRESHOLD_DETECTION_ACTIVITY
): ):