mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-08-04 13:47:37 +02:00
Improve frame cache debugging (#18741)
This commit is contained in:
parent
2d586eeeb7
commit
d727adddde
@ -266,8 +266,13 @@ class CameraState:
|
|||||||
)
|
)
|
||||||
|
|
||||||
# add initial frame to frame cache
|
# add initial frame to frame cache
|
||||||
logger.debug(f"{self.name}: Adding {frame_time} to frame cache for {id}")
|
logger.debug(
|
||||||
self.frame_cache[frame_time] = np.copy(current_frame)
|
f"{self.name}: New object, adding {frame_time} to frame cache for {id}"
|
||||||
|
)
|
||||||
|
self.frame_cache[frame_time] = {
|
||||||
|
"frame": np.copy(current_frame),
|
||||||
|
"object_id": id,
|
||||||
|
}
|
||||||
|
|
||||||
# save initial thumbnail data and best object
|
# save initial thumbnail data and best object
|
||||||
thumbnail_data = {
|
thumbnail_data = {
|
||||||
@ -313,7 +318,13 @@ class CameraState:
|
|||||||
updated_obj.thumbnail_data["frame_time"] == frame_time
|
updated_obj.thumbnail_data["frame_time"] == frame_time
|
||||||
and frame_time not in self.frame_cache
|
and frame_time not in self.frame_cache
|
||||||
):
|
):
|
||||||
self.frame_cache[frame_time] = np.copy(current_frame)
|
logger.debug(
|
||||||
|
f"{self.name}: Existing object, adding {frame_time} to frame cache for {id}"
|
||||||
|
)
|
||||||
|
self.frame_cache[frame_time] = {
|
||||||
|
"frame": np.copy(current_frame),
|
||||||
|
"object_id": id,
|
||||||
|
}
|
||||||
|
|
||||||
updated_obj.last_updated = frame_time
|
updated_obj.last_updated = frame_time
|
||||||
|
|
||||||
@ -431,9 +442,8 @@ class CameraState:
|
|||||||
if t not in current_thumb_frames and t not in current_best_frames
|
if t not in current_thumb_frames and t not in current_best_frames
|
||||||
]
|
]
|
||||||
for t in thumb_frames_to_delete:
|
for t in thumb_frames_to_delete:
|
||||||
logger.debug(
|
object_id = self.frame_cache[t].get("object_id", "unknown")
|
||||||
f"{self.name}: Deleting {t} from frame cache for {obj.obj_data['id']}"
|
logger.debug(f"{self.name}: Deleting {t} from frame cache for {object_id}")
|
||||||
)
|
|
||||||
del self.frame_cache[t]
|
del self.frame_cache[t]
|
||||||
|
|
||||||
with self.current_frame_lock:
|
with self.current_frame_lock:
|
||||||
|
@ -419,7 +419,7 @@ class TrackedObject:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
best_frame = cv2.cvtColor(
|
best_frame = cv2.cvtColor(
|
||||||
self.frame_cache[self.thumbnail_data["frame_time"]],
|
self.frame_cache[self.thumbnail_data["frame_time"]]["frame"],
|
||||||
cv2.COLOR_YUV2BGR_I420,
|
cv2.COLOR_YUV2BGR_I420,
|
||||||
)
|
)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
@ -448,7 +448,7 @@ class TrackedObject:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
best_frame = cv2.cvtColor(
|
best_frame = cv2.cvtColor(
|
||||||
self.frame_cache[self.thumbnail_data["frame_time"]],
|
self.frame_cache[self.thumbnail_data["frame_time"]]["frame"],
|
||||||
cv2.COLOR_YUV2BGR_I420,
|
cv2.COLOR_YUV2BGR_I420,
|
||||||
)
|
)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
Loading…
Reference in New Issue
Block a user