Zhen Ye commited on
Commit
4c39d24
·
1 Parent(s): 45eb65b

added debug level logging for GPU inferenciing and distance

Browse files
Files changed (1) hide show
  1. inference.py +7 -0
inference.py CHANGED
@@ -301,6 +301,7 @@ def infer_frame(
301
  # Add depth to label, e.g. "car 12m"
302
  depth_str = f"{int(det['depth_est_m'])}m"
303
  label = f"{label} {depth_str}"
 
304
  display_labels.append(label)
305
 
306
  except Exception:
@@ -467,6 +468,8 @@ def run_inference(
467
  detector_instance = detectors[gpu_idx]
468
  depth_instance = depth_estimators[gpu_idx] if depth_estimators else None
469
 
 
 
470
  # Run depth estimation every 3 frames if configured
471
  active_depth_name = depth_estimator_name if (frame_idx % 3 == 0) else None
472
  active_depth_instance = depth_instance if (frame_idx % 3 == 0) else None
@@ -570,6 +573,8 @@ def run_segmentation(
570
  gpu_idx = frame_idx % len(segmenters)
571
  segmenter_instance = segmenters[gpu_idx]
572
 
 
 
573
  processed, _ = infer_segmentation_frame(
574
  frame_data,
575
  text_queries=queries,
@@ -711,6 +716,8 @@ def process_frames_depth(
711
  gpu_idx = frame_idx % len(estimators)
712
  estimator_instance = estimators[gpu_idx]
713
 
 
 
714
  # Use instance lock
715
  if hasattr(estimator_instance, "lock"):
716
  lock = estimator_instance.lock
 
301
  # Add depth to label, e.g. "car 12m"
302
  depth_str = f"{int(det['depth_est_m'])}m"
303
  label = f"{label} {depth_str}"
304
+ logging.debug("Object '%s' at %s (bbox: %s)", label, depth_str, det['bbox'])
305
  display_labels.append(label)
306
 
307
  except Exception:
 
468
  detector_instance = detectors[gpu_idx]
469
  depth_instance = depth_estimators[gpu_idx] if depth_estimators else None
470
 
471
+ logging.debug("Processing frame %d on GPU %d (cuda:%d)", frame_idx, gpu_idx, gpu_idx)
472
+
473
  # Run depth estimation every 3 frames if configured
474
  active_depth_name = depth_estimator_name if (frame_idx % 3 == 0) else None
475
  active_depth_instance = depth_instance if (frame_idx % 3 == 0) else None
 
573
  gpu_idx = frame_idx % len(segmenters)
574
  segmenter_instance = segmenters[gpu_idx]
575
 
576
+ logging.debug("Segmenting frame %d on GPU %d (cuda:%d)", frame_idx, gpu_idx, gpu_idx)
577
+
578
  processed, _ = infer_segmentation_frame(
579
  frame_data,
580
  text_queries=queries,
 
716
  gpu_idx = frame_idx % len(estimators)
717
  estimator_instance = estimators[gpu_idx]
718
 
719
+ logging.debug("Estimating depth for frame %d on GPU %d (cuda:%d)", frame_idx, gpu_idx, gpu_idx)
720
+
721
  # Use instance lock
722
  if hasattr(estimator_instance, "lock"):
723
  lock = estimator_instance.lock