Add more debug logs

This commit is contained in:
Nicolas Mowen 2024-10-22 10:39:42 -06:00
parent acfacaaa5d
commit 9a683bff93

View File

@ -147,6 +147,9 @@ class EmbeddingMaintainer(threading.Thread):
pass pass
if yuv_frame is None: if yuv_frame is None:
logger.debug(
"Unable to process object update because frame is unavailable."
)
return return
if self.face_recognition_enabled: if self.face_recognition_enabled:
@ -287,10 +290,14 @@ class EmbeddingMaintainer(threading.Thread):
"""Look for faces in image.""" """Look for faces in image."""
# don't run for non person objects # don't run for non person objects
if obj_data.get("label") != "person": if obj_data.get("label") != "person":
logger.debug("Not a processing face for non person object.")
return return
# don't overwrite sub label for objects that have one # don't overwrite sub label for objects that have one
if obj_data.get("sub_label"): if obj_data.get("sub_label"):
logger.debug(
f"Not processing face due to existing sub label: {obj_data.get('sub_label')}."
)
return return
face: Optional[dict[str, any]] = None face: Optional[dict[str, any]] = None
@ -301,6 +308,7 @@ class EmbeddingMaintainer(threading.Thread):
else: else:
# don't run for object without attributes # don't run for object without attributes
if not obj_data.get("current_attributes"): if not obj_data.get("current_attributes"):
logger.debug("No attributes to parse.")
return return
attributes: list[dict[str, any]] = obj_data.get("current_attributes", []) attributes: list[dict[str, any]] = obj_data.get("current_attributes", [])
@ -322,6 +330,7 @@ class EmbeddingMaintainer(threading.Thread):
not face_box not face_box
or area(face_box) < self.config.semantic_search.face_recognition.min_area or area(face_box) < self.config.semantic_search.face_recognition.min_area
): ):
logger.debug(f"Invalid face box {face}")
return return
face_frame = cv2.cvtColor(frame, cv2.COLOR_YUV2BGR_I420) face_frame = cv2.cvtColor(frame, cv2.COLOR_YUV2BGR_I420)
@ -331,6 +340,7 @@ class EmbeddingMaintainer(threading.Thread):
) )
if not ret: if not ret:
logger.debug("Not processing face due to error creating cropped image.")
return return
embedding = self.embeddings.embed_face("unknown", jpg.tobytes(), upsert=False) embedding = self.embeddings.embed_face("unknown", jpg.tobytes(), upsert=False)