Round robin SHM management (#15027)

* Output frame name to frames processor

* Finish implementing round robin

* Formatting
This commit is contained in:
Nicolas Mowen
2024-11-16 16:00:19 -07:00
committed by GitHub
parent f9c1600f0d
commit 45e9030358
11 changed files with 134 additions and 97 deletions

View File

@@ -9,5 +9,7 @@ class ObjectTracker(ABC):
pass
@abstractmethod
def match_and_update(self, frame_time: float, detections) -> None:
def match_and_update(
self, frame_name: str, frame_time: float, detections: list[dict[str, any]]
) -> None:
pass

View File

@@ -129,7 +129,7 @@ class CentroidTracker(ObjectTracker):
self.tracked_objects[id].update(new_obj)
def update_frame_times(self, frame_time):
def update_frame_times(self, frame_name, frame_time):
for id in list(self.tracked_objects.keys()):
self.tracked_objects[id]["frame_time"] = frame_time
self.tracked_objects[id]["motionless_count"] += 1

View File

@@ -268,7 +268,7 @@ class NorfairTracker(ObjectTracker):
self.tracked_objects[id].update(obj)
def update_frame_times(self, frame_time):
def update_frame_times(self, frame_name: str, frame_time: float):
# if the object was there in the last frame, assume it's still there
detections = [
(
@@ -282,9 +282,11 @@ class NorfairTracker(ObjectTracker):
for id, obj in self.tracked_objects.items()
if self.disappeared[id] == 0
]
self.match_and_update(frame_time, detections=detections)
self.match_and_update(frame_name, frame_time, detections=detections)
def match_and_update(self, frame_time, detections):
def match_and_update(
self, frame_name: str, frame_time: float, detections: list[dict[str, any]]
):
norfair_detections = []
for obj in detections:
@@ -322,7 +324,7 @@ class NorfairTracker(ObjectTracker):
)
coord_transformations = self.ptz_motion_estimator.motion_estimator(
detections, frame_time, self.camera_name
detections, frame_name, frame_time, self.camera_name
)
tracked_objects = self.tracker.update(