Face_detectrion: service.py tidying up logging, changed status of some mesages form infor to debug.

This commit is contained in:
2026-05-08 11:33:42 +02:00
parent 8018e769c0
commit cf184d765c
@@ -70,7 +70,7 @@ class FaceDetectionService:
self.ctx.devs.lamp_light = 2.5
zoom_value = self.ctx.devs.zoom
self.logger.info("face detection sequence")
self.logger.info("Starting face detection sequence")
self.ctx.devs.set_zoom(zoom_value, wait=True)
boxes_face: dict[int, tuple[float, float, float, float]] = {}
@@ -106,7 +106,7 @@ class FaceDetectionService:
)
if not model or not model.box:
self.logger.info(f"no box found for angle {angle}")
self.logger.warning(f"no box found for angle {angle}")
self._emit_running_progress(angle=angle, boxes_face=boxes_face)
continue
@@ -122,12 +122,12 @@ class FaceDetectionService:
if cls_id == 3:
boxes_face[angle] = (x1, y1, x2, y2)
self.logger.info(
self.logger.debug(
f"accepted box at angle {angle}, cls={cls_id}, box={(x1, y1, x2, y2)}"
)
elif cls_id == 0:
boxes_loop[angle] = (x1, y1, x2, y2)
self.logger.info(
self.logger.debug(
f"accepted box at angle {angle}, cls={cls_id}, box={(x1, y1, x2, y2)}"
)
else:
@@ -136,7 +136,7 @@ class FaceDetectionService:
self._emit_running_progress(angle=angle, boxes_face=boxes_face)
if not boxes_face and not boxes_loop:
self.logger.info("no boxes found")
self.logger.warning("no boxes found")
payload = self._emit_empty_result()
return FaceDetectionResult(success=True, payload=payload)
@@ -145,17 +145,17 @@ class FaceDetectionService:
if boxes_face and face_ratio >= face_min_ratio:
boxes = boxes_face
self.logger.info(
self.logger.debug(
f"using loop_face boxes ({len(boxes_face)}/{total_detections}, ratio={face_ratio:.2f})"
)
elif boxes_loop:
boxes = boxes_loop
self.logger.info(
self.logger.debug(
f"falling back to loop_all boxes ({len(boxes_loop)}/{total_detections}, ratio={1 - face_ratio:.2f})"
)
else:
boxes = boxes_face
self.logger.info(f"using loop_face boxes (only source, {len(boxes_face)} entries)")
self.logger.debug(f"using loop_face boxes (only source, {len(boxes_face)} entries)")
best_fit_angle_area, area_params = fd.get_flat_face(boxes, start_angle, end_angle, True)
best_fit_angle_height, height_params = fd.get_flat_face(boxes, start_angle, end_angle, False)
@@ -164,19 +164,19 @@ class FaceDetectionService:
"Height": {"angle": best_fit_angle_height, "params": height_params},
}
self.logger.info(f"best angle by area: {best_fit_angle_area}")
self.logger.info(f"best angle by height: {best_fit_angle_height}")
self.logger.debug(f"best angle by area: {best_fit_angle_area}")
self.logger.debug(f"best angle by height: {best_fit_angle_height}")
flat_face_angle, best_params, best_name = fd.choose_best_fit(fit_results)
self.logger.info(f"best params: {best_params}")
self.logger.info(f"chosen fit: {best_name}")
self.logger.debug(f"best params: {best_params}")
self.logger.debug(f"chosen fit: {best_name}")
self.logger.info(f"best angle: {flat_face_angle}")
self.ctx.devs.aerotech_omega = flat_face_angle
samples_out = fd.get_samples_out(boxes)
self.logger.info(f"face detection sequence done, samples: {samples_out}")
self.logger.info(f"Face detection sequence complete")
payload = {
"running": False,