From 8270967cdc1ffaed7e2fc35eb7d045edd8be71f0 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Thu, 17 Apr 2025 13:48:09 -0600 Subject: [PATCH] UI Fixes (#17762) * Fix handling of non existing cameras in groups * Update docs * Improve typing --- docs/docs/configuration/object_detectors.md | 2 +- frigate/detectors/detection_api.py | 4 ++-- web/src/components/filter/SearchFilterGroup.tsx | 11 +++++++++++ web/src/views/search/SearchView.tsx | 12 ++++++++++++ 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/docs/docs/configuration/object_detectors.md b/docs/docs/configuration/object_detectors.md index 370fdb00a..5b92c03d0 100644 --- a/docs/docs/configuration/object_detectors.md +++ b/docs/docs/configuration/object_detectors.md @@ -882,7 +882,7 @@ output_name: "{input_basename}" config: mean_values: [[0, 0, 0]] std_values: [[255, 255, 255]] - quant_img_rgb2bgr: true + quant_img_RGB2BGR: true ``` Explanation of the paramters: diff --git a/frigate/detectors/detection_api.py b/frigate/detectors/detection_api.py index 403bce574..ccccc1b65 100644 --- a/frigate/detectors/detection_api.py +++ b/frigate/detectors/detection_api.py @@ -4,7 +4,7 @@ from typing import List import numpy as np -from frigate.detectors.detector_config import ModelTypeEnum +from frigate.detectors.detector_config import BaseDetectorConfig, ModelTypeEnum logger = logging.getLogger(__name__) @@ -14,7 +14,7 @@ class DetectionApi(ABC): supported_models: List[ModelTypeEnum] @abstractmethod - def __init__(self, detector_config): + def __init__(self, detector_config: BaseDetectorConfig): self.detector_config = detector_config self.thresh = 0.5 self.height = detector_config.model.height diff --git a/web/src/components/filter/SearchFilterGroup.tsx b/web/src/components/filter/SearchFilterGroup.tsx index 77cd95db0..a35ca145e 100644 --- a/web/src/components/filter/SearchFilterGroup.tsx +++ b/web/src/components/filter/SearchFilterGroup.tsx @@ -63,6 +63,11 @@ export default function SearchFilterGroup({ return; } const cameraConfig = config.cameras[camera]; + + if (!cameraConfig) { + return; + } + cameraConfig.objects.track.forEach((label) => { if (!config.model.all_attributes.includes(label)) { labels.add(label); @@ -99,7 +104,13 @@ export default function SearchFilterGroup({ if (camera == "birdseye") { return; } + const cameraConfig = config.cameras[camera]; + + if (!cameraConfig) { + return; + } + Object.entries(cameraConfig.zones).map(([name, _]) => { zones.add(name); }); diff --git a/web/src/views/search/SearchView.tsx b/web/src/views/search/SearchView.tsx index 96a7d7be6..7fadeccaa 100644 --- a/web/src/views/search/SearchView.tsx +++ b/web/src/views/search/SearchView.tsx @@ -107,7 +107,13 @@ export default function SearchView({ if (camera == "birdseye") { return; } + const cameraConfig = config.cameras[camera]; + + if (!cameraConfig) { + return; + } + cameraConfig.objects.track.forEach((label) => { labels.add(label); }); @@ -139,7 +145,13 @@ export default function SearchView({ if (camera == "birdseye") { return; } + const cameraConfig = config.cameras[camera]; + + if (!cameraConfig) { + return; + } + Object.entries(cameraConfig.zones).map(([name, _]) => { zones.add(name); });