From 9476ca0dc3e6d40be82ae13c53403720b51b467b Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Tue, 15 Apr 2025 09:32:51 -0500 Subject: [PATCH] config for model size --- frigate/config/classification.py | 3 +++ frigate/embeddings/onnx/lpr_embedding.py | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/frigate/config/classification.py b/frigate/config/classification.py index 83425ac30b..0ad86da27d 100644 --- a/frigate/config/classification.py +++ b/frigate/config/classification.py @@ -103,6 +103,9 @@ class LicensePlateRecognitionConfig(FrigateBaseModel): default=LPRDeviceEnum.CPU, title="The device used for license plate recognition.", ) + model_size: str = Field( + default="small", title="The size of the embeddings model used." + ) detection_threshold: float = Field( default=0.7, title="License plate object confidence score required to begin running recognition.", diff --git a/frigate/embeddings/onnx/lpr_embedding.py b/frigate/embeddings/onnx/lpr_embedding.py index cfe8fb16f2..ac981da8d3 100644 --- a/frigate/embeddings/onnx/lpr_embedding.py +++ b/frigate/embeddings/onnx/lpr_embedding.py @@ -31,11 +31,14 @@ class PaddleOCRDetection(BaseEmbedding): requestor: InterProcessRequestor, device: str = "AUTO", ): + model_file = ( + "detection-large.onnx" if model_size == "large" else "detection-small.onnx" + ) super().__init__( model_name="paddleocr-onnx", - model_file="detection.onnx", + model_file=model_file, download_urls={ - "detection.onnx": "https://github.com/hawkeye217/paddleocr-onnx/raw/refs/heads/master/models/detection.onnx" + model_file: f"https://github.com/hawkeye217/paddleocr-onnx/raw/refs/heads/master/models/{model_file}" }, ) self.requestor = requestor