mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-09-23 17:52:05 +02:00
Dynamically adjust to configured attribute map for lpr (#20079)
This commit is contained in:
parent
6cd1d1f205
commit
5f34a18905
@ -50,6 +50,13 @@ class LicensePlateProcessingMixin:
|
||||
)
|
||||
self.batch_size = 6
|
||||
|
||||
# Object config
|
||||
self.lp_objects: list[str] = []
|
||||
|
||||
for obj, attributes in self.config.model.attributes_map.items():
|
||||
if "license_plate" in attributes:
|
||||
self.lp_objects.append(obj)
|
||||
|
||||
# Detection specific parameters
|
||||
self.min_size = 8
|
||||
self.max_size = 960
|
||||
@ -1254,7 +1261,7 @@ class LicensePlateProcessingMixin:
|
||||
|
||||
# don't run for non car/motorcycle or non license plate (dedicated lpr with frigate+) objects
|
||||
if (
|
||||
obj_data.get("label") not in ["car", "motorcycle"]
|
||||
obj_data.get("label") not in self.lp_objects
|
||||
and obj_data.get("label") != "license_plate"
|
||||
):
|
||||
logger.debug(
|
||||
@ -1346,7 +1353,7 @@ class LicensePlateProcessingMixin:
|
||||
logger.debug(f"{camera}: No attributes to parse.")
|
||||
return
|
||||
|
||||
if obj_data.get("label") in ["car", "motorcycle"]:
|
||||
if obj_data.get("label") in self.lp_objects:
|
||||
attributes: list[dict[str, Any]] = obj_data.get(
|
||||
"current_attributes", []
|
||||
)
|
||||
|
@ -66,7 +66,12 @@ def has_better_attr(current_thumb, new_obj, attr_label) -> bool:
|
||||
return max_new_attr > max_current_attr
|
||||
|
||||
|
||||
def is_better_thumbnail(label, current_thumb, new_obj, frame_shape) -> bool:
|
||||
def is_better_thumbnail(
|
||||
label: str,
|
||||
current_thumb: dict[str, Any],
|
||||
new_obj: dict[str, Any],
|
||||
frame_shape: tuple[int, int],
|
||||
) -> bool:
|
||||
# larger is better
|
||||
# cutoff images are less ideal, but they should also be smaller?
|
||||
# better scores are obviously better too
|
||||
|
Loading…
Reference in New Issue
Block a user