mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-04-10 23:08:37 +02:00
* Halfway point for fixing data processing * Fix mixin types missing * Cleanup LPR mypy * Cleanup audio mypy * Cleanup bird mypy * Cleanup mypy for custom classification * remove whisper * Fix DB typing * Cleanup events mypy * Clenaup * fix type evaluation * Cleanup * Fix broken imports
38 lines
1.3 KiB
Python
38 lines
1.3 KiB
Python
from frigate.comms.inter_process import InterProcessRequestor
|
|
from frigate.embeddings.onnx.lpr_embedding import (
|
|
LicensePlateDetector,
|
|
PaddleOCRClassification,
|
|
PaddleOCRDetection,
|
|
PaddleOCRRecognition,
|
|
)
|
|
|
|
from ...types import DataProcessorModelRunner
|
|
|
|
|
|
class LicensePlateModelRunner(DataProcessorModelRunner):
|
|
def __init__(
|
|
self,
|
|
requestor: InterProcessRequestor,
|
|
device: str = "CPU",
|
|
model_size: str = "small",
|
|
):
|
|
super().__init__(requestor, device, model_size)
|
|
self.detection_model = PaddleOCRDetection(
|
|
model_size=model_size, requestor=requestor, device=device
|
|
)
|
|
self.classification_model = PaddleOCRClassification(
|
|
model_size=model_size, requestor=requestor, device=device
|
|
)
|
|
self.recognition_model = PaddleOCRRecognition(
|
|
model_size=model_size, requestor=requestor, device=device
|
|
)
|
|
self.yolov9_detection_model = LicensePlateDetector(
|
|
model_size=model_size, requestor=requestor, device=device
|
|
)
|
|
|
|
# Load all models once
|
|
self.detection_model._load_model_and_utils()
|
|
self.classification_model._load_model_and_utils()
|
|
self.recognition_model._load_model_and_utils()
|
|
self.yolov9_detection_model._load_model_and_utils()
|