LPR tweaks (#17783)

* clarify docs

* improve debugging messages

* don't run any lpr postprocessing

* wording
This commit is contained in:
Josh Hawkins
2025-04-18 08:45:37 -05:00
committed by GitHub
parent 19aaa64fe9
commit 14a32a6472
5 changed files with 37 additions and 14 deletions

View File

@@ -490,10 +490,6 @@ class LicensePlateProcessingMixin:
merged_boxes.append(current_box)
current_box = next_box
logger.debug(
f"Provided plate_width: {plate_width}, max_gap: {max_gap}, horizontal_gap: {horizontal_gap}"
)
# Add the last box
merged_boxes.append(current_box)
@@ -1133,7 +1129,7 @@ class LicensePlateProcessingMixin:
# 4. Log the comparison
logger.debug(
f"Plate comparison - Current: {top_plate} (score: {curr_score:.3f}, min_conf: {curr_min_conf:.2f}) vs "
f"Previous: {prev_plate} (score: {prev_score:.3f}, min_conf: {prev_min_conf:.2f})\n"
f"Previous: {prev_plate} (score: {prev_score:.3f}, min_conf: {prev_min_conf:.2f}) "
f"Metrics - Length: {len(top_plate)} vs {len(prev_plate)} (scores: {curr_length_score:.2f} vs {prev_length_score:.2f}), "
f"Area: {top_area} vs {prev_area}, "
f"Avg Conf: {avg_confidence:.2f} vs {prev_avg_confidence:.2f}, "
@@ -1263,6 +1259,15 @@ class LicensePlateProcessingMixin:
)
return
# don't run for objects with no position changes
# this is the initial state after registering a new tracked object
# LPR will run 2 frames after detect.min_initialized is reached
if obj_data.get("position_changes", 0) == 0:
logger.debug(
f"{camera}: Plate detected in {self.config.cameras[camera].detect.min_initialized + 1} concurrent frames, LPR frame threshold ({self.config.cameras[camera].detect.min_initialized + 2})"
)
return
license_plate: Optional[dict[str, any]] = None
if "license_plate" not in self.config.cameras[camera].objects.track:
@@ -1401,6 +1406,8 @@ class LicensePlateProcessingMixin:
license_plate_frame,
)
logger.debug(f"{camera}: Running plate recognition.")
# run detection, returns results sorted by confidence, best first
start = datetime.datetime.now().timestamp()
license_plates, confidences, areas = self._process_license_plate(