mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-08-03 17:43:59 +03:00
LPR improvements (#20129)
* continue to use paddleocr v3 text detection model for large v5 was not finding text on multi-line plates at all in testing * implement clustering of plate variants per event should reduce OCR inconsistencies and improve plate recognition stability by using string similarity to cluster similar variants (10 per event id) and choosing the highest confidence representative as the final plate * pass camera * prune number of variants based on detect fps * implement replacement rules for cleaning up and normalizing plates * docs * docs
This commit is contained in:
@@ -217,6 +217,13 @@ class CameraFaceRecognitionConfig(FrigateBaseModel):
|
||||
model_config = ConfigDict(extra="forbid", protected_namespaces=())
|
||||
|
||||
|
||||
class ReplaceRule(FrigateBaseModel):
|
||||
pattern: str = Field(..., title="Regex pattern to match.")
|
||||
replacement: str = Field(
|
||||
..., title="Replacement string (supports backrefs like '\\1')."
|
||||
)
|
||||
|
||||
|
||||
class LicensePlateRecognitionConfig(FrigateBaseModel):
|
||||
enabled: bool = Field(default=False, title="Enable license plate recognition.")
|
||||
model_size: str = Field(
|
||||
@@ -269,6 +276,10 @@ class LicensePlateRecognitionConfig(FrigateBaseModel):
|
||||
title="The device key to use for LPR.",
|
||||
description="This is an override, to target a specific device. See https://onnxruntime.ai/docs/execution-providers/ for more information",
|
||||
)
|
||||
replace_rules: List[ReplaceRule] = Field(
|
||||
default_factory=list,
|
||||
title="List of regex replacement rules for normalizing detected plates. Each rule has 'pattern' and 'replacement'.",
|
||||
)
|
||||
|
||||
|
||||
class CameraLicensePlateRecognitionConfig(FrigateBaseModel):
|
||||
|
||||
Reference in New Issue
Block a user