Change camera stats to be more structured

This commit is contained in:
tpjanssen 2023-10-13 17:43:25 +02:00
parent 9b687d77ce
commit fec977f8c7

View File

@ -248,6 +248,7 @@ def stats_snapshot(
total_detection_fps = 0
stats["cameras"] = {}
for name, camera_stats in camera_metrics.items():
total_detection_fps += camera_stats["detection_fps"].value
pid = camera_stats["process"].pid if camera_stats["process"] else None
@ -259,7 +260,7 @@ def stats_snapshot(
if camera_stats["capture_process"]
else None
)
stats[name] = {
stats["cameras"][name] = {
"camera_fps": round(camera_stats["camera_fps"].value, 2),
"process_fps": round(camera_stats["process_fps"].value, 2),
"skipped_fps": round(camera_stats["skipped_fps"].value, 2),
@ -271,6 +272,7 @@ def stats_snapshot(
"audio_rms": round(camera_stats["audio_rms"].value, 4),
"audio_dBFS": round(camera_stats["audio_dBFS"].value, 4),
}
stats[name] = stats["cameras"][name] # deprecate in the future?
stats["detectors"] = {}
for name, detector in stats_tracking["detectors"].items():