mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-15 15:45:27 +03:00
fix processing
This commit is contained in:
parent
ce45c54969
commit
0dfc1967cc
@ -495,7 +495,7 @@ class EmbeddingMaintainer(threading.Thread):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# don't overwrite sub label for objects that have a sub label
|
# don't overwrite sub label for objects that have a sub label
|
||||||
# that is not a face
|
# that is not a license plate
|
||||||
if obj_data.get("sub_label") and id not in self.detected_license_plates:
|
if obj_data.get("sub_label") and id not in self.detected_license_plates:
|
||||||
logger.debug(
|
logger.debug(
|
||||||
f"Not processing license plate due to existing sub label: {obj_data.get('sub_label')}."
|
f"Not processing license plate due to existing sub label: {obj_data.get('sub_label')}."
|
||||||
@ -525,7 +525,7 @@ class EmbeddingMaintainer(threading.Thread):
|
|||||||
|
|
||||||
license_plate_box = license_plate.get("box")
|
license_plate_box = license_plate.get("box")
|
||||||
|
|
||||||
# check that face is valid
|
# check that license plate is valid
|
||||||
if not license_plate_box or area(license_plate_box) < self.config.lpr.min_area:
|
if not license_plate_box or area(license_plate_box) < self.config.lpr.min_area:
|
||||||
logger.debug(f"Invalid license plate box {license_plate}")
|
logger.debug(f"Invalid license plate box {license_plate}")
|
||||||
return
|
return
|
||||||
@ -553,13 +553,16 @@ class EmbeddingMaintainer(threading.Thread):
|
|||||||
else:
|
else:
|
||||||
logger.debug("No text detected")
|
logger.debug("No text detected")
|
||||||
|
|
||||||
if confidences[0] < self.config.face_recognition.threshold:
|
if confidences[0] < self.lpr_config.threshold or (
|
||||||
|
id in self.detected_license_plates
|
||||||
|
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})."
|
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)})."
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
requests.post(
|
resp = requests.post(
|
||||||
f"{FRIGATE_LOCALHOST}/api/events/{id}/sub_label",
|
f"{FRIGATE_LOCALHOST}/api/events/{id}/sub_label",
|
||||||
json={
|
json={
|
||||||
"camera": obj_data.get("camera"),
|
"camera": obj_data.get("camera"),
|
||||||
@ -568,6 +571,9 @@ class EmbeddingMaintainer(threading.Thread):
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if resp.status_code == 200:
|
||||||
|
self.detected_license_plates[id] = confidences[0]
|
||||||
|
|
||||||
def _create_thumbnail(self, yuv_frame, box, height=500) -> Optional[bytes]:
|
def _create_thumbnail(self, yuv_frame, box, height=500) -> Optional[bytes]:
|
||||||
"""Return jpg thumbnail of a region of the frame."""
|
"""Return jpg thumbnail of a region of the frame."""
|
||||||
frame = cv2.cvtColor(yuv_frame, cv2.COLOR_YUV2BGR_I420)
|
frame = cv2.cvtColor(yuv_frame, cv2.COLOR_YUV2BGR_I420)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user