add license plate as attribute to motorcycle

This commit is contained in:
Josh Hawkins 2025-04-15 09:54:19 -05:00
parent 78bf8880f9
commit 8e8ba1b291
3 changed files with 8 additions and 8 deletions

View File

@ -1246,20 +1246,20 @@ class LicensePlateProcessingMixin:
else: else:
id = obj_data["id"] 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 ( if (
obj_data.get("label") != "car" obj_data.get("label") not in ["car", "motorcycle"]
and obj_data.get("label") != "license_plate" and obj_data.get("label") != "license_plate"
): ):
logger.debug( 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 return
# don't run for stationary car objects # don't run for stationary car objects
if obj_data.get("stationary") == True: if obj_data.get("stationary") == True:
logger.debug( 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 return
@ -1298,7 +1298,7 @@ class LicensePlateProcessingMixin:
if not license_plate: if not license_plate:
logger.debug( logger.debug(
f"{camera}: Detected no license plates for car object." f"{camera}: Detected no license plates for car/motorcycle object."
) )
return return
@ -1330,7 +1330,7 @@ class LicensePlateProcessingMixin:
logger.debug(f"{camera}: No attributes to parse.") logger.debug(f"{camera}: No attributes to parse.")
return return
if obj_data.get("label") == "car": if obj_data.get("label") in ["car", "motorcycle"]:
attributes: list[dict[str, any]] = obj_data.get( attributes: list[dict[str, any]] = obj_data.get(
"current_attributes", [] "current_attributes", []
) )

View File

@ -279,7 +279,7 @@ class TrackedObject:
self.attributes[attr["label"]] = attr["score"] self.attributes[attr["label"]] = attr["score"]
# populate the sub_label for object with highest scoring logo # 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 = { recognized_logos = {
k: self.attributes[k] for k in self.logos if k in self.attributes k: self.attributes[k] for k in self.logos if k in self.attributes
} }

View File

@ -80,7 +80,7 @@ def is_better_thumbnail(label, current_thumb, new_obj, frame_shape) -> bool:
return False return False
# check license_plate on car # check license_plate on car
if label == "car": if label in ["car", "motorcycle"]:
if has_better_attr(current_thumb, new_obj, "license_plate"): if has_better_attr(current_thumb, new_obj, "license_plate"):
return True return True
# if the current thumb has a license_plate attr, dont update unless it gets better # if the current thumb has a license_plate attr, dont update unless it gets better