Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix max_frames, improve stationary objects in masked areas #6815

Merged
merged 4 commits into from Jun 16, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 7 additions & 4 deletions frigate/track/norfair_tracker.py
Expand Up @@ -91,9 +91,13 @@ def register(self, track_id, obj):
"ymax": self.detect_config.height,
}

def deregister(self, id):
def deregister(self, id, track_id):
del self.tracked_objects[id]
del self.disappeared[id]
self.tracker.tracked_objects = [
o for o in self.tracker.tracked_objects if o.global_id != track_id
]
del self.track_id_map[track_id]

# tracks the current position of the object based on the last N bounding boxes
# returns False if the object has moved outside its previous position
Expand Down Expand Up @@ -167,7 +171,7 @@ def update(self, track_id, obj):
if self.update_position(id, obj["box"]):
self.tracked_objects[id]["motionless_count"] += 1
if self.is_expired(id):
self.deregister(id)
self.deregister(id, track_id)
return
else:
# register the first position change and then only increment if
Expand Down Expand Up @@ -261,8 +265,7 @@ def match_and_update(self, frame_time, detections):
# clear expired tracks
expired_ids = [k for k in self.track_id_map.keys() if k not in active_ids]
for e_id in expired_ids:
self.deregister(self.track_id_map[e_id])
del self.track_id_map[e_id]
self.deregister(self.track_id_map[e_id], e_id)

def debug_draw(self, frame, frame_time):
active_detections = [
Expand Down
4 changes: 2 additions & 2 deletions frigate/video.py
Expand Up @@ -769,8 +769,8 @@ def process_frames(
stationary_object_ids = [
obj["id"]
for obj in object_tracker.tracked_objects.values()
# if there hasn't been motion for 10 frames
if obj["motionless_count"] >= 10
# if it has exceeded the stationary threshold
if obj["motionless_count"] >= detect_config.stationary.threshold
# and it isn't due for a periodic check
and (
detect_config.stationary.interval == 0
Expand Down