Refactor: Logging Cleanup
This commit is contained in:
parent
7a9a149955
commit
5176f99ba7
9 changed files with 37 additions and 72 deletions
|
@ -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()
|
||||
|
|
|
@ -503,17 +503,6 @@ class DetectionPipeline:
|
|||
'filename': f"{uuid.uuid4()}.jpg"
|
||||
}
|
||||
|
||||
# Save full frame for debugging
|
||||
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}/pipeline_full_frame_{session_id}_{timestamp}.jpg"
|
||||
try:
|
||||
cv2.imwrite(debug_filename, frame)
|
||||
logger.info(f"[DEBUG PIPELINE] Saved full input frame: {debug_filename} ({frame.shape[1]}x{frame.shape[0]})")
|
||||
except Exception as e:
|
||||
logger.warning(f"[DEBUG PIPELINE] Failed to save debug frame: {e}")
|
||||
|
||||
# Run inference on single snapshot using .predict() method
|
||||
detection_results = self.detection_model.model.predict(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue