mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-18 17:14:26 +03:00
ensure all trackers are correctly updated even when there are no detections
This commit is contained in:
parent
4c9075c588
commit
af59742321
@ -425,15 +425,29 @@ class NorfairTracker(ObjectTracker):
|
|||||||
detections, frame_name, frame_time, self.camera_name
|
detections, frame_name, frame_time, self.camera_name
|
||||||
)
|
)
|
||||||
|
|
||||||
# Update each tracker with its corresponding detections
|
# Update all configured trackers
|
||||||
all_tracked_objects = []
|
all_tracked_objects = []
|
||||||
for label, label_detections in detections_by_type.items():
|
for label in self.trackers:
|
||||||
tracker = self.get_tracker(label)
|
tracker = self.get_tracker(label)
|
||||||
tracked_objects = tracker.update(
|
tracked_objects = tracker.update(
|
||||||
detections=label_detections, coord_transformations=coord_transformations
|
detections=detections_by_type.get(label, []),
|
||||||
|
coord_transformations=coord_transformations,
|
||||||
)
|
)
|
||||||
all_tracked_objects.extend(tracked_objects)
|
all_tracked_objects.extend(tracked_objects)
|
||||||
|
|
||||||
|
# Collect detections for objects without specific trackers
|
||||||
|
default_detections = []
|
||||||
|
for label, dets in detections_by_type.items():
|
||||||
|
if label not in self.trackers:
|
||||||
|
default_detections.extend(dets)
|
||||||
|
|
||||||
|
# Update default tracker with untracked detections
|
||||||
|
mode = "ptz" if self.ptz_metrics.autotracker_enabled else "static"
|
||||||
|
tracked_objects = self.default_tracker[mode].update(
|
||||||
|
detections=default_detections, coord_transformations=coord_transformations
|
||||||
|
)
|
||||||
|
all_tracked_objects.extend(tracked_objects)
|
||||||
|
|
||||||
# update or create new tracks
|
# update or create new tracks
|
||||||
active_ids = []
|
active_ids = []
|
||||||
for t in all_tracked_objects:
|
for t in all_tracked_objects:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user