mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
Prevent division by zero in lpr confidence checks (#14615)
This commit is contained in:
parent
848654311b
commit
978bc4828c
@ -599,14 +599,20 @@ class EmbeddingMaintainer(threading.Thread):
|
|||||||
return
|
return
|
||||||
|
|
||||||
top_plate, top_char_confidences = license_plates[0], confidences[0]
|
top_plate, top_char_confidences = license_plates[0], confidences[0]
|
||||||
avg_confidence = sum(top_char_confidences) / len(top_char_confidences)
|
avg_confidence = (
|
||||||
|
(sum(top_char_confidences) / len(top_char_confidences))
|
||||||
|
if top_char_confidences
|
||||||
|
else 0
|
||||||
|
)
|
||||||
|
|
||||||
# Check if we have a previously detected plate for this ID
|
# Check if we have a previously detected plate for this ID
|
||||||
if id in self.detected_license_plates:
|
if id in self.detected_license_plates:
|
||||||
prev_plate = self.detected_license_plates[id]["plate"]
|
prev_plate = self.detected_license_plates[id]["plate"]
|
||||||
prev_char_confidences = self.detected_license_plates[id]["char_confidences"]
|
prev_char_confidences = self.detected_license_plates[id]["char_confidences"]
|
||||||
prev_avg_confidence = sum(prev_char_confidences) / len(
|
prev_avg_confidence = (
|
||||||
prev_char_confidences
|
(sum(prev_char_confidences) / len(prev_char_confidences))
|
||||||
|
if prev_char_confidences
|
||||||
|
else 0
|
||||||
)
|
)
|
||||||
|
|
||||||
# Define conditions for keeping the previous plate
|
# Define conditions for keeping the previous plate
|
||||||
|
Loading…
Reference in New Issue
Block a user