mirror of
				https://github.com/blakeblackshear/frigate.git
				synced 2025-10-27 10:52:11 +01:00 
			
		
		
		
	Classification config changes (#17892)
* Only auto-populate some config fields down to the camera level - Don't populate LPR and face global-only settings down to the camera level - Ensure LPR mixin uses camera level min_area - Explicitly forbid extra config values for LPR and face * lpr docs tweak * remove extra text already in i18n key * consistency
This commit is contained in:
		
							parent
							
								
									eb4433162c
								
							
						
					
					
						commit
						2610cfcfde
					
				@ -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
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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=())
 | 
			
		||||
 | 
			
		||||
@ -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}
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -898,8 +898,7 @@ function PtzControlPanel({
 | 
			
		||||
              <p>
 | 
			
		||||
                {clickOverlay
 | 
			
		||||
                  ? t("ptz.move.clickMove.disable")
 | 
			
		||||
                  : t("ptz.move.clickMove.enable")}{" "}
 | 
			
		||||
                click to move
 | 
			
		||||
                  : t("ptz.move.clickMove.enable")}
 | 
			
		||||
              </p>
 | 
			
		||||
            </TooltipContent>
 | 
			
		||||
          </Tooltip>
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user