This commit is contained in:
Josh Hawkins 2024-10-25 15:10:36 -05:00
parent f8b1a27e1f
commit 706ed0c578

View File

@ -535,7 +535,7 @@ class EmbeddingMaintainer(threading.Thread):
logger.debug(f"Invalid license plate box {license_plate}") logger.debug(f"Invalid license plate box {license_plate}")
return return
license_plate_frame = cv2.cvtColor(frame, cv2.COLOR_YUV2RGB) license_plate_frame = cv2.cvtColor(frame, cv2.COLOR_YUV2BGR_I420)
license_plate_frame = license_plate_frame[ license_plate_frame = license_plate_frame[
license_plate_box[1] : license_plate_box[3], license_plate_box[1] : license_plate_box[3],
license_plate_box[0] : license_plate_box[2], license_plate_box[0] : license_plate_box[2],
@ -556,14 +556,16 @@ class EmbeddingMaintainer(threading.Thread):
f"Detected text: {plate} (average confidence: {confidence:.2f}, area: {text_area} pixels)" f"Detected text: {plate} (average confidence: {confidence:.2f}, area: {text_area} pixels)"
) )
else: else:
# no plates found
logger.debug("No text detected") logger.debug("No text detected")
return
if confidences[0] < self.lpr_config.threshold or ( if confidences[0] < self.lpr_config.threshold or (
id in self.detected_license_plates id in self.detected_license_plates
and confidences[0] <= self.detected_license_plates[id] and confidences[0] <= self.detected_license_plates[id]
): ):
logger.debug( logger.debug(
f"Recognized license plate top score {confidence[0]} is less than threshold ({self.config.lpr.threshold}) / previous license plate score ({self.detected_license_plates.get(id)})." f"Recognized license plate top score {confidences[0]} is less than threshold ({self.config.lpr.threshold}) / previous license plate score ({self.detected_license_plates.get(id)})."
) )
return return