Refactor: Logging Cleanup

This commit is contained in:
ziesorx 2025-09-24 20:39:32 +07:00
parent 7a9a149955
commit 5176f99ba7
9 changed files with 37 additions and 72 deletions

View file

@ -441,19 +441,6 @@ class BranchProcessor:
logger.info(f"[INFERENCE START] {branch_id}: Running inference on {'cropped' if input_frame is not frame else 'full'} frame "
f"({input_frame.shape[1]}x{input_frame.shape[0]}) with confidence={min_confidence}")
# Save input frame for debugging
import os
import cv2
debug_dir = "/Users/ziesorx/Documents/Work/Adsist/Bangchak/worker/python-detector-worker/debug_frames"
timestamp = detection_context.get('timestamp', 'unknown')
session_id = detection_context.get('session_id', 'unknown')
debug_filename = f"{debug_dir}/{branch_id}_{session_id}_{timestamp}_input.jpg"
try:
cv2.imwrite(debug_filename, input_frame)
logger.info(f"[DEBUG] Saved inference input frame: {debug_filename} ({input_frame.shape[1]}x{input_frame.shape[0]})")
except Exception as e:
logger.warning(f"[DEBUG] Failed to save debug frame: {e}")
# Use .predict() method for both detection and classification models
inference_start = time.time()