Add speed and rate metrics for custom classification models

This commit is contained in:
Nicolas Mowen 2025-06-06 07:11:41 -06:00
parent be8ee068e2
commit e65f0560e4
2 changed files with 12 additions and 2 deletions

View File

@ -89,11 +89,12 @@ class FrigateApp:
self.log_queue: Queue = mp.Queue() self.log_queue: Queue = mp.Queue()
self.camera_metrics: dict[str, CameraMetrics] = {} self.camera_metrics: dict[str, CameraMetrics] = {}
self.embeddings_metrics: DataProcessorMetrics | None = ( self.embeddings_metrics: DataProcessorMetrics | None = (
DataProcessorMetrics() DataProcessorMetrics(config.classification.custom)
if ( if (
config.semantic_search.enabled config.semantic_search.enabled
or config.lpr.enabled or config.lpr.enabled
or config.face_recognition.enabled or config.face_recognition.enabled
or len(config.classification.custom) > 0
) )
else None else None
) )

View File

@ -20,8 +20,10 @@ class DataProcessorMetrics:
alpr_pps: Synchronized alpr_pps: Synchronized
yolov9_lpr_speed: Synchronized yolov9_lpr_speed: Synchronized
yolov9_lpr_pps: Synchronized yolov9_lpr_pps: Synchronized
classification_speeds: dict[str, Synchronized]
classification_cps: dict[str, Synchronized]
def __init__(self): def __init__(self, custom_classification_models: list[str]):
self.image_embeddings_speed = mp.Value("d", 0.0) self.image_embeddings_speed = mp.Value("d", 0.0)
self.image_embeddings_eps = mp.Value("d", 0.0) self.image_embeddings_eps = mp.Value("d", 0.0)
self.text_embeddings_speed = mp.Value("d", 0.0) self.text_embeddings_speed = mp.Value("d", 0.0)
@ -33,6 +35,13 @@ class DataProcessorMetrics:
self.yolov9_lpr_speed = mp.Value("d", 0.0) self.yolov9_lpr_speed = mp.Value("d", 0.0)
self.yolov9_lpr_pps = mp.Value("d", 0.0) self.yolov9_lpr_pps = mp.Value("d", 0.0)
if custom_classification_models:
self.classification_speeds = {}
self.classification_cps = {}
for key in custom_classification_models:
self.classification_speeds[key] = mp.Value("d", 0.0)
self.classification_cps[key] = mp.Value("d", 0.0)
class DataProcessorModelRunner: class DataProcessorModelRunner:
def __init__(self, requestor, device: str = "CPU", model_size: str = "large"): def __init__(self, requestor, device: str = "CPU", model_size: str = "large"):