mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-13 14:45:25 +03:00
A bit more cleanup for references to active, referencing the tracked object method rather than duplicating logic.
This commit is contained in:
parent
782ab40098
commit
9be1eec5fd
@ -166,6 +166,9 @@ class TrackedObject:
|
|||||||
if self.computed_score > self.top_score:
|
if self.computed_score > self.top_score:
|
||||||
self.top_score = self.computed_score
|
self.top_score = self.computed_score
|
||||||
self.false_positive = self._is_false_positive()
|
self.false_positive = self._is_false_positive()
|
||||||
|
if not self.active == self.is_active():
|
||||||
|
# State transition between stationary/active.
|
||||||
|
significant_change = True
|
||||||
self.active = self.is_active()
|
self.active = self.is_active()
|
||||||
|
|
||||||
if not self.false_positive:
|
if not self.false_positive:
|
||||||
@ -251,16 +254,7 @@ class TrackedObject:
|
|||||||
if self.obj_data["attributes"] != obj_data["attributes"]:
|
if self.obj_data["attributes"] != obj_data["attributes"]:
|
||||||
significant_change = True
|
significant_change = True
|
||||||
|
|
||||||
# if the motionless_count reaches the stationary threshold
|
|
||||||
if (
|
|
||||||
self.obj_data["motionless_count"]
|
|
||||||
== self.camera_config.detect.stationary.threshold
|
|
||||||
):
|
|
||||||
significant_change = True
|
|
||||||
|
|
||||||
# or if the motionless_count resets
|
|
||||||
if self.obj_data["motionless_count"] == 0:
|
|
||||||
significant_change = True
|
|
||||||
|
|
||||||
# update at least once per minute
|
# update at least once per minute
|
||||||
if self.obj_data["frame_time"] - self.previous["frame_time"] > 60:
|
if self.obj_data["frame_time"] - self.previous["frame_time"] > 60:
|
||||||
@ -311,7 +305,7 @@ class TrackedObject:
|
|||||||
return not self.is_stationary()
|
return not self.is_stationary()
|
||||||
|
|
||||||
def is_stationary(self):
|
def is_stationary(self):
|
||||||
return self.obj_data["motionless_count"] >= self.camera_config.detect.stationary.threshold
|
return self.obj_data["motionless_count"] > self.camera_config.detect.stationary.threshold
|
||||||
|
|
||||||
def get_thumbnail(self):
|
def get_thumbnail(self):
|
||||||
if (
|
if (
|
||||||
@ -744,10 +738,7 @@ class CameraState:
|
|||||||
|
|
||||||
for obj in tracked_objects.values():
|
for obj in tracked_objects.values():
|
||||||
object_type = obj.obj_data["label"]
|
object_type = obj.obj_data["label"]
|
||||||
active = (
|
active = obj.is_active()
|
||||||
obj.obj_data["motionless_count"]
|
|
||||||
< self.camera_config.detect.stationary.threshold
|
|
||||||
)
|
|
||||||
|
|
||||||
if not obj.false_positive:
|
if not obj.false_positive:
|
||||||
label = object_type
|
label = object_type
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user