mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-05-04 04:27:42 +03:00
catch lpr model inference exceptions
This commit is contained in:
parent
e2cf316a62
commit
bd8107f54c
@ -79,7 +79,12 @@ class LicensePlateProcessingMixin:
|
|||||||
resized_image,
|
resized_image,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
outputs = self.model_runner.detection_model([normalized_image])[0]
|
outputs = self.model_runner.detection_model([normalized_image])[0]
|
||||||
|
except Exception as e:
|
||||||
|
logger.warning(f"Error running LPR box detection model: {e}")
|
||||||
|
return []
|
||||||
|
|
||||||
outputs = outputs[0, :, :]
|
outputs = outputs[0, :, :]
|
||||||
|
|
||||||
if False:
|
if False:
|
||||||
@ -115,7 +120,11 @@ class LicensePlateProcessingMixin:
|
|||||||
norm_img = norm_img[np.newaxis, :]
|
norm_img = norm_img[np.newaxis, :]
|
||||||
norm_images.append(norm_img)
|
norm_images.append(norm_img)
|
||||||
|
|
||||||
|
try:
|
||||||
outputs = self.model_runner.classification_model(norm_images)
|
outputs = self.model_runner.classification_model(norm_images)
|
||||||
|
except Exception as e:
|
||||||
|
logger.warning(f"Error running LPR classification model: {e}")
|
||||||
|
return
|
||||||
|
|
||||||
return self._process_classification_output(images, outputs)
|
return self._process_classification_output(images, outputs)
|
||||||
|
|
||||||
@ -152,7 +161,10 @@ class LicensePlateProcessingMixin:
|
|||||||
norm_image = norm_image[np.newaxis, :]
|
norm_image = norm_image[np.newaxis, :]
|
||||||
norm_images.append(norm_image)
|
norm_images.append(norm_image)
|
||||||
|
|
||||||
|
try:
|
||||||
outputs = self.model_runner.recognition_model(norm_images)
|
outputs = self.model_runner.recognition_model(norm_images)
|
||||||
|
except Exception as e:
|
||||||
|
logger.warning(f"Error running LPR recognition model: {e}")
|
||||||
return self.ctc_decoder(outputs)
|
return self.ctc_decoder(outputs)
|
||||||
|
|
||||||
def _process_license_plate(
|
def _process_license_plate(
|
||||||
@ -968,7 +980,11 @@ class LicensePlateProcessingMixin:
|
|||||||
|
|
||||||
Return the dimensions of the detected plate as [x1, y1, x2, y2].
|
Return the dimensions of the detected plate as [x1, y1, x2, y2].
|
||||||
"""
|
"""
|
||||||
|
try:
|
||||||
predictions = self.model_runner.yolov9_detection_model(input)
|
predictions = self.model_runner.yolov9_detection_model(input)
|
||||||
|
except Exception as e:
|
||||||
|
logger.warning(f"Error running YOLOv9 license plate detection model: {e}")
|
||||||
|
return None
|
||||||
|
|
||||||
confidence_threshold = self.lpr_config.detection_threshold
|
confidence_threshold = self.lpr_config.detection_threshold
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user