mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-12-06 05:24:11 +03:00
More stationary cleanup (#20229)
Some checks failed
CI / AMD64 Extra Build (push) Has been cancelled
CI / ARM Extra Build (push) Has been cancelled
CI / Synaptics Build (push) Has been cancelled
CI / Assemble and push default build (push) Has been cancelled
CI / AMD64 Build (push) Has been cancelled
CI / ARM Build (push) Has been cancelled
CI / Jetson Jetpack 6 (push) Has been cancelled
Some checks failed
CI / AMD64 Extra Build (push) Has been cancelled
CI / ARM Extra Build (push) Has been cancelled
CI / Synaptics Build (push) Has been cancelled
CI / Assemble and push default build (push) Has been cancelled
CI / AMD64 Build (push) Has been cancelled
CI / ARM Build (push) Has been cancelled
CI / Jetson Jetpack 6 (push) Has been cancelled
* Always return false for active objects * Cleanup
This commit is contained in:
parent
b8b07ee6e1
commit
e6cbc93703
@ -330,6 +330,18 @@ class NorfairTracker(ObjectTracker):
|
|||||||
stationary: bool,
|
stationary: bool,
|
||||||
yuv_frame: np.ndarray | None,
|
yuv_frame: np.ndarray | None,
|
||||||
) -> bool:
|
) -> bool:
|
||||||
|
def reset_position(xmin: int, ymin: int, xmax: int, ymax: int) -> None:
|
||||||
|
self.positions[id] = {
|
||||||
|
"xmins": [xmin],
|
||||||
|
"ymins": [ymin],
|
||||||
|
"xmaxs": [xmax],
|
||||||
|
"ymaxs": [ymax],
|
||||||
|
"xmin": xmin,
|
||||||
|
"ymin": ymin,
|
||||||
|
"xmax": xmax,
|
||||||
|
"ymax": ymax,
|
||||||
|
}
|
||||||
|
|
||||||
xmin, ymin, xmax, ymax = box
|
xmin, ymin, xmax, ymax = box
|
||||||
position = self.positions[id]
|
position = self.positions[id]
|
||||||
self.stationary_box_history[id].append(box)
|
self.stationary_box_history[id].append(box)
|
||||||
@ -360,17 +372,11 @@ class NorfairTracker(ObjectTracker):
|
|||||||
if not self.stationary_classifier.evaluate(
|
if not self.stationary_classifier.evaluate(
|
||||||
id, yuv_frame, cast(tuple[int, int, int, int], tuple(box))
|
id, yuv_frame, cast(tuple[int, int, int, int], tuple(box))
|
||||||
):
|
):
|
||||||
self.positions[id] = {
|
reset_position(xmin, ymin, xmax, ymax)
|
||||||
"xmins": [xmin],
|
|
||||||
"ymins": [ymin],
|
|
||||||
"xmaxs": [xmax],
|
|
||||||
"ymaxs": [ymax],
|
|
||||||
"xmin": xmin,
|
|
||||||
"ymin": ymin,
|
|
||||||
"xmax": xmax,
|
|
||||||
"ymax": ymax,
|
|
||||||
}
|
|
||||||
return False
|
return False
|
||||||
|
else:
|
||||||
|
reset_position(xmin, ymin, xmax, ymax)
|
||||||
|
return False
|
||||||
|
|
||||||
threshold = (
|
threshold = (
|
||||||
THRESHOLD_STATIONARY_CHECK_IOU if stationary else THRESHOLD_ACTIVE_CHECK_IOU
|
THRESHOLD_STATIONARY_CHECK_IOU if stationary else THRESHOLD_ACTIVE_CHECK_IOU
|
||||||
@ -391,22 +397,16 @@ class NorfairTracker(ObjectTracker):
|
|||||||
# if the median iou drops below the threshold
|
# if the median iou drops below the threshold
|
||||||
# assume object is no longer stationary
|
# assume object is no longer stationary
|
||||||
if median_iou < threshold:
|
if median_iou < threshold:
|
||||||
# Before flipping to active, check with classifier if we have YUV frame
|
# If we have a yuv_frame to check before flipping to active, check with classifier if we have YUV frame
|
||||||
if stationary and yuv_frame is not None:
|
if stationary and yuv_frame is not None:
|
||||||
if not self.stationary_classifier.evaluate(
|
if not self.stationary_classifier.evaluate(
|
||||||
id, yuv_frame, cast(tuple[int, int, int, int], tuple(box))
|
id, yuv_frame, cast(tuple[int, int, int, int], tuple(box))
|
||||||
):
|
):
|
||||||
self.positions[id] = {
|
reset_position(xmin, ymin, xmax, ymax)
|
||||||
"xmins": [xmin],
|
|
||||||
"ymins": [ymin],
|
|
||||||
"xmaxs": [xmax],
|
|
||||||
"ymaxs": [ymax],
|
|
||||||
"xmin": xmin,
|
|
||||||
"ymin": ymin,
|
|
||||||
"xmax": xmax,
|
|
||||||
"ymax": ymax,
|
|
||||||
}
|
|
||||||
return False
|
return False
|
||||||
|
else:
|
||||||
|
reset_position(xmin, ymin, xmax, ymax)
|
||||||
|
return False
|
||||||
|
|
||||||
# if there are more than 5 and less than 10 entries for the position, add the bounding box
|
# if there are more than 5 and less than 10 entries for the position, add the bounding box
|
||||||
# and recompute the position box
|
# and recompute the position box
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user