use estimated boxes for regions

This commit is contained in:
Blake Blackshear 2023-06-09 07:36:38 -05:00
parent a4117297e2
commit af3d964e9c
2 changed files with 8 additions and 3 deletions

View File

@ -231,16 +231,21 @@ class NorfairTracker(ObjectTracker):
# update or create new tracks
active_ids = []
for t in tracked_objects:
obj = {
**t.last_detection.data,
"estimate": tuple(t.estimate.flatten().astype(int)),
}
active_ids.append(t.global_id)
if t.global_id not in self.track_id_map:
self.register(t.global_id, t.last_detection.data)
self.register(t.global_id, obj)
# if there wasn't a detection in this frame, increment disappeared
elif t.last_detection.data["frame_time"] != frame_time:
id = self.track_id_map[t.global_id]
self.disappeared[id] += 1
self.tracked_objects[id]["estimate"] = obj["estimate"]
# else update it
else:
self.update(t.global_id, t.last_detection.data)
self.update(t.global_id, obj)
# clear expired tracks
expired_ids = [k for k in self.track_id_map.keys() if k not in active_ids]

View File

@ -656,7 +656,7 @@ def process_frames(
# get tracked object boxes that aren't stationary
tracked_object_boxes = [
obj["box"]
obj["estimate"]
for obj in object_tracker.tracked_objects.values()
if obj["id"] not in stationary_object_ids
]