From 8e8ba1b2913983d5a6ec87894e4974aa4e20f546 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Tue, 15 Apr 2025 09:54:19 -0500 Subject: [PATCH] add license plate as attribute to motorcycle --- .../data_processing/common/license_plate/mixin.py | 12 ++++++------ frigate/track/tracked_object.py | 2 +- frigate/util/image.py | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/frigate/data_processing/common/license_plate/mixin.py b/frigate/data_processing/common/license_plate/mixin.py index 64ccde368f..9ce702d61d 100644 --- a/frigate/data_processing/common/license_plate/mixin.py +++ b/frigate/data_processing/common/license_plate/mixin.py @@ -1246,20 +1246,20 @@ class LicensePlateProcessingMixin: else: id = obj_data["id"] - # don't run for non car or non license plate (dedicated lpr with frigate+) objects + # don't run for non car/motorcycle or non license plate (dedicated lpr with frigate+) objects if ( - obj_data.get("label") != "car" + obj_data.get("label") not in ["car", "motorcycle"] and obj_data.get("label") != "license_plate" ): logger.debug( - f"{camera}: Not a processing license plate for non car object." + f"{camera}: Not a processing license plate for non car/motorcycle object." ) return # don't run for stationary car objects if obj_data.get("stationary") == True: logger.debug( - f"{camera}: Not a processing license plate for a stationary car object." + f"{camera}: Not a processing license plate for a stationary car/motorcycle object." ) return @@ -1298,7 +1298,7 @@ class LicensePlateProcessingMixin: if not license_plate: logger.debug( - f"{camera}: Detected no license plates for car object." + f"{camera}: Detected no license plates for car/motorcycle object." ) return @@ -1330,7 +1330,7 @@ class LicensePlateProcessingMixin: logger.debug(f"{camera}: No attributes to parse.") return - if obj_data.get("label") == "car": + if obj_data.get("label") in ["car", "motorcycle"]: attributes: list[dict[str, any]] = obj_data.get( "current_attributes", [] ) diff --git a/frigate/track/tracked_object.py b/frigate/track/tracked_object.py index 58a4e0b83b..b1ac72a3f3 100644 --- a/frigate/track/tracked_object.py +++ b/frigate/track/tracked_object.py @@ -279,7 +279,7 @@ class TrackedObject: self.attributes[attr["label"]] = attr["score"] # populate the sub_label for object with highest scoring logo - if self.obj_data["label"] in ["car", "package", "person"]: + if self.obj_data["label"] in ["car", "motorcycle", "package", "person"]: recognized_logos = { k: self.attributes[k] for k in self.logos if k in self.attributes } diff --git a/frigate/util/image.py b/frigate/util/image.py index 93827747c3..5abbfb943e 100644 --- a/frigate/util/image.py +++ b/frigate/util/image.py @@ -80,7 +80,7 @@ def is_better_thumbnail(label, current_thumb, new_obj, frame_shape) -> bool: return False # check license_plate on car - if label == "car": + if label in ["car", "motorcycle"]: if has_better_attr(current_thumb, new_obj, "license_plate"): return True # if the current thumb has a license_plate attr, dont update unless it gets better