NVR with realtime local object detection for IP cameras
TypeScript aicameragoogle-coralhome-assistanthome-automationhomeautomationmqttnvrobject-detectionrealtimertsptensorflow
Added total camera fps, total processed fps, and total skipped fps to stats api (#19469)
markfrancisonly8e663413bb18
diff --git a/frigate/stats/util.py b/frigate/stats/util.pyindex a071dae1f5..ee93bb6e69 100644--- a/frigate/stats/util.py+++ b/frigate/stats/util.py@@ -268,10 +268,13 @@ def stats_snapshot(camera_metrics = stats_tracking["camera_metrics"]stats: dict[str, Any] = {}- total_detection_fps = 0+ total_camera_fps = total_process_fps = total_skipped_fps = total_detection_fps = 0stats["cameras"] = {}for name, camera_stats in camera_metrics.items():+ total_camera_fps += camera_stats.camera_fps.value+ total_process_fps += camera_stats.process_fps.value+ total_skipped_fps += camera_stats.skipped_fps.valuetotal_detection_fps += camera_stats.detection_fps.valuepid = camera_stats.process_pid.value if camera_stats.process_pid.value else Noneffmpeg_pid = camera_stats.ffmpeg_pid.value if camera_stats.ffmpeg_pid else None@@ -305,6 +308,9 @@ def stats_snapshot(# from mypy 0.981 onwards"pid": pid,}+ stats["camera_fps"] = round(total_camera_fps, 2)+ stats["process_fps"] = round(total_process_fps, 2)+ stats["skipped_fps"] = round(total_skipped_fps, 2)stats["detection_fps"] = round(total_detection_fps, 2)stats["embeddings"] = {}diff --git a/frigate/test/http_api/base_http_test.py b/frigate/test/http_api/base_http_test.pyindex e758a14dcc..e0e5fbf030 100644--- a/frigate/test/http_api/base_http_test.py+++ b/frigate/test/http_api/base_http_test.py@@ -45,6 +45,9 @@ class BaseTestHttp(unittest.TestCase):},}self.test_stats = {+ "camera_fps": 5.0,+ "process_fps": 5.0,+ "skipped_fps": 0.0,"detection_fps": 13.7,"detectors": {"cpu1": {diff --git a/frigate/test/test_http.py b/frigate/test/test_http.pyindex ba31b09081..6d60932a59 100644--- a/frigate/test/test_http.py+++ b/frigate/test/test_http.py@@ -49,6 +49,9 @@ class TestHttp(unittest.TestCase):},}self.test_stats = {+ "camera_fps": 5.0,+ "process_fps": 5.0,+ "skipped_fps": 0.0,"detection_fps": 13.7,"detectors": {"cpu1": {diff --git a/web/src/types/stats.ts b/web/src/types/stats.tsindex 611379be30..a196dff181 100644--- a/web/src/types/stats.ts+++ b/web/src/types/stats.ts@@ -7,6 +7,9 @@ export interface FrigateStats {npu_usages?: { [npuKey: string]: NpuStats };processes: { [processKey: string]: ExtraProcessStats };service: ServiceStats;+ camera_fps: number;+ process_fps: number;+ skipped_fps: number;detection_fps: number;}diff --git a/web/src/views/system/CameraMetrics.tsx b/web/src/views/system/CameraMetrics.tsxindex 3f58912650..5c3594e796 100644--- a/web/src/views/system/CameraMetrics.tsx+++ b/web/src/views/system/CameraMetrics.tsx@@ -97,14 +97,9 @@ export default function CameraMetrics({return;}- let frames = 0;- Object.values(stats.cameras).forEach(- (camStat) => (frames += camStat.camera_fps),- );-series["overall_fps"].data.push({x: statsIdx,- y: Math.round(frames),+ y: stats.camera_fps,});series["overall_dps"].data.push({@@ -112,14 +107,9 @@ export default function CameraMetrics({y: stats.detection_fps,});- let skipped = 0;- Object.values(stats.cameras).forEach(- (camStat) => (skipped += camStat.skipped_fps),- );-series["overall_skipped_dps"].data.push({x: statsIdx,- y: skipped,+ y: stats.skipped_fps,});});return Object.values(series);