diff --git a/docs/docs/configuration/license_plate_recognition.md b/docs/docs/configuration/license_plate_recognition.md index e75d0ce1d..c5565fed5 100644 --- a/docs/docs/configuration/license_plate_recognition.md +++ b/docs/docs/configuration/license_plate_recognition.md @@ -56,7 +56,7 @@ Like the other real-time processors in Frigate, license plate recognition runs o ## Advanced Configuration -Fine-tune the LPR feature using these optional parameters at the global level of your config. The only optional parameters that should be set at the camera level are `enabled`, `min_area`, and `enhancement`. +Fine-tune the LPR feature using these optional parameters at the global level of your config. The only optional parameters that can be set at the camera level are `enabled`, `min_area`, and `enhancement`. ### Detection diff --git a/frigate/config/classification.py b/frigate/config/classification.py index 0ad86da27..7f4f39bbd 100644 --- a/frigate/config/classification.py +++ b/frigate/config/classification.py @@ -94,7 +94,7 @@ class CameraFaceRecognitionConfig(FrigateBaseModel): default=500, title="Min area of face box to consider running face recognition." ) - model_config = ConfigDict(extra="ignore", protected_namespaces=()) + model_config = ConfigDict(extra="forbid", protected_namespaces=()) class LicensePlateRecognitionConfig(FrigateBaseModel): @@ -168,4 +168,4 @@ class CameraLicensePlateRecognitionConfig(FrigateBaseModel): le=10, ) - model_config = ConfigDict(extra="ignore", protected_namespaces=()) + model_config = ConfigDict(extra="forbid", protected_namespaces=()) diff --git a/frigate/config/config.py b/frigate/config/config.py index 373e08376..2470818b0 100644 --- a/frigate/config/config.py +++ b/frigate/config/config.py @@ -472,8 +472,24 @@ class FrigateConfig(FrigateBaseModel): ) for name, camera in self.cameras.items(): + modified_global_config = global_config.copy() + + # only populate some fields down to the camera level for specific keys + allowed_fields_map = { + "face_recognition": ["enabled", "min_area"], + "lpr": ["enabled", "expire_time", "min_area", "enhancement"], + } + + for section in allowed_fields_map: + if section in modified_global_config: + modified_global_config[section] = { + k: v + for k, v in modified_global_config[section].items() + if k in allowed_fields_map[section] + } + merged_config = deep_merge( - camera.model_dump(exclude_unset=True), global_config + camera.model_dump(exclude_unset=True), modified_global_config ) camera_config: CameraConfig = CameraConfig.model_validate( {"name": name, **merged_config} diff --git a/frigate/data_processing/common/license_plate/mixin.py b/frigate/data_processing/common/license_plate/mixin.py index afd5c8280..e471aa304 100644 --- a/frigate/data_processing/common/license_plate/mixin.py +++ b/frigate/data_processing/common/license_plate/mixin.py @@ -1221,7 +1221,7 @@ class LicensePlateProcessingMixin: license_plate_area = (license_plate[2] - license_plate[0]) * ( license_plate[3] - license_plate[1] ) - if license_plate_area < self.lpr_config.min_area: + if license_plate_area < self.config.cameras[camera].lpr.min_area: logger.debug(f"{camera}: License plate area below minimum threshold.") return @@ -1315,10 +1315,7 @@ class LicensePlateProcessingMixin: # check that license plate is valid # double the value because we've doubled the size of the car - if ( - license_plate_area - < self.config.cameras[obj_data["camera"]].lpr.min_area * 2 - ): + if license_plate_area < self.config.cameras[camera].lpr.min_area * 2: logger.debug(f"{camera}: License plate is less than min_area") return @@ -1362,10 +1359,10 @@ class LicensePlateProcessingMixin: if ( not license_plate_box or area(license_plate_box) - < self.config.cameras[obj_data["camera"]].lpr.min_area + < self.config.cameras[camera].lpr.min_area ): logger.debug( - f"{camera}: Area for license plate box {area(license_plate_box)} is less than min_area {self.config.cameras[obj_data['camera']].lpr.min_area}" + f"{camera}: Area for license plate box {area(license_plate_box)} is less than min_area {self.config.cameras[camera].lpr.min_area}" ) return diff --git a/web/src/views/live/LiveCameraView.tsx b/web/src/views/live/LiveCameraView.tsx index a9b4710b8..6866118c5 100644 --- a/web/src/views/live/LiveCameraView.tsx +++ b/web/src/views/live/LiveCameraView.tsx @@ -898,8 +898,7 @@ function PtzControlPanel({

{clickOverlay ? t("ptz.move.clickMove.disable") - : t("ptz.move.clickMove.enable")}{" "} - click to move + : t("ptz.move.clickMove.enable")}