mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-03-10 10:33:11 +03:00
Some checks are pending
CI / AMD64 Build (push) Waiting to run
CI / ARM Build (push) Waiting to run
CI / Jetson Jetpack 6 (push) Waiting to run
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / ARM Extra Build (push) Blocked by required conditions
CI / Synaptics Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions
* face recognition dynamic config * lpr dynamic config * safe changes for birdseye dynamic config * bird classification dynamic config * always assign new config to stats emitter to make telemetry fields dynamic * add wildcard support for camera config updates in config_set * update restart required fields for global sections * add test * fix rebase issue * collapsible settings sidebar use the preexisting control available with shadcn's sidebar (cmd/ctrl-B) to give users more space to set masks/zones on smaller screens * dynamic ffmpeg * ensure previews dir exists when ffmpeg processes restart, there's a brief window where the preview frame generation pipeline is torn down and restarted. before these changes, ffmpeg only restarted on crash/stall recovery or full Frigate restart. Now that ffmpeg restarts happen on-demand via config changes, there's a higher chance a frontend request hits the preview_mp4 or preview_gif endpoints during that brief restart window when the directory might not exist yet. The existing os.listdir() call would throw FileNotFoundError without a directory existence check. this fix just checks if the directory exists and returns 404 if not, exactly how preview_thumbnail already handles the same scenario a few lines below * global ffmpeg section * clean up * tweak * fix test
64 lines
2.1 KiB
Python
64 lines
2.1 KiB
Python
"""Handle processing images for face detection and recognition."""
|
|
|
|
import logging
|
|
from typing import Any
|
|
|
|
import numpy as np
|
|
|
|
from frigate.comms.event_metadata_updater import EventMetadataPublisher
|
|
from frigate.comms.inter_process import InterProcessRequestor
|
|
from frigate.config import FrigateConfig
|
|
from frigate.config.classification import LicensePlateRecognitionConfig
|
|
from frigate.data_processing.common.license_plate.mixin import (
|
|
LicensePlateProcessingMixin,
|
|
)
|
|
from frigate.data_processing.common.license_plate.model import (
|
|
LicensePlateModelRunner,
|
|
)
|
|
|
|
from ..types import DataProcessorMetrics
|
|
from .api import RealTimeProcessorApi
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
class LicensePlateRealTimeProcessor(LicensePlateProcessingMixin, RealTimeProcessorApi):
|
|
def __init__(
|
|
self,
|
|
config: FrigateConfig,
|
|
requestor: InterProcessRequestor,
|
|
sub_label_publisher: EventMetadataPublisher,
|
|
metrics: DataProcessorMetrics,
|
|
model_runner: LicensePlateModelRunner,
|
|
detected_license_plates: dict[str, dict[str, Any]],
|
|
):
|
|
self.requestor = requestor
|
|
self.detected_license_plates = detected_license_plates
|
|
self.model_runner = model_runner
|
|
self.lpr_config = config.lpr
|
|
self.config = config
|
|
self.sub_label_publisher = sub_label_publisher
|
|
self.camera_current_cars: dict[str, list[str]] = {}
|
|
super().__init__(config, metrics)
|
|
|
|
def update_config(self, lpr_config: LicensePlateRecognitionConfig) -> None:
|
|
"""Update LPR config at runtime."""
|
|
self.lpr_config = lpr_config
|
|
logger.debug("LPR config updated dynamically")
|
|
|
|
def process_frame(
|
|
self,
|
|
obj_data: dict[str, Any],
|
|
frame: np.ndarray,
|
|
dedicated_lpr: bool | None = False,
|
|
):
|
|
"""Look for license plates in image."""
|
|
self.lpr_process(obj_data, frame, dedicated_lpr)
|
|
|
|
def handle_request(self, topic, request_data) -> dict[str, Any] | None:
|
|
return
|
|
|
|
def expire_object(self, object_id: str, camera: str):
|
|
"""Expire lpr objects."""
|
|
self.lpr_expire(object_id, camera)
|