mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-05-04 12:37:43 +03:00
Fixes to determine if a segment is to be considered as calibrating.
This commit is contained in:
parent
5af9fa2d2f
commit
71c498b992
@ -530,7 +530,11 @@ def motion_activity(params: ReviewActivityMotionQueryParams = Depends()):
|
||||
.to_frame()
|
||||
)
|
||||
cameras = df["camera"].resample(f"{scale}s").agg(lambda x: ",".join(set(x)))
|
||||
calibrations = df["is_calibrating"].resample(f"{scale}s").apply(lambda x: all(x))
|
||||
calibrations = (
|
||||
df["is_calibrating"]
|
||||
.resample(f"{scale}s")
|
||||
.apply(lambda x: (len(x) > 0 and all(x)))
|
||||
)
|
||||
df = motion.join(cameras).join(calibrations)
|
||||
|
||||
length = df.shape[0]
|
||||
|
||||
@ -388,9 +388,15 @@ class RecordingMaintainer(threading.Thread):
|
||||
]
|
||||
)
|
||||
motion_count += len(frame[2])
|
||||
is_calibrating += frame[3]
|
||||
is_calibrating = is_calibrating or frame[3]
|
||||
region_count += len(frame[4])
|
||||
|
||||
# if there is any motion frame without calibrating, consider the section as non-calibrating.
|
||||
is_calibrating = is_calibrating and not any(
|
||||
len(frame[2]) > 0 and not frame[3]
|
||||
for frame in self.object_recordings_info[camera]
|
||||
)
|
||||
|
||||
audio_values = []
|
||||
for frame in self.audio_recordings_info[camera]:
|
||||
# frame is after end time of segment
|
||||
|
||||
@ -57,7 +57,16 @@ export const useMotionSegmentUtils = (
|
||||
(acc, curr) => acc + (curr.motion ?? 0),
|
||||
0,
|
||||
);
|
||||
const isCalibrating = matchingEvents.every((curr) => curr.is_calibrating);
|
||||
// A segment is considered calibration only when there is no "non-calibrating" motion.
|
||||
const isCalibrating =
|
||||
matchingEvents.some((curr) => curr.is_calibrating) &&
|
||||
matchingEvents.every(
|
||||
(curr) =>
|
||||
!curr.motion ||
|
||||
(curr.motion > 0 &&
|
||||
curr.is_calibrating != undefined &&
|
||||
curr.is_calibrating),
|
||||
);
|
||||
|
||||
return { totalMotion: totalMotion, isCalibrating: isCalibrating };
|
||||
},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user