Zhen Ye Claude Opus 4.6 commited on
Commit
0d3be57
·
1 Parent(s): ba91677

Fix Grounding DINO detections dropped by ByteTracker threshold mismatch

Browse files

Lower ByteTracker new_track_thresh from 0.40 to 0.30 so DINO scores
(≥0.35) can spawn tracks. Harden DINO _post_process to remove bare
fallback that silently dropped to HuggingFace default threshold of 0.25.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

models/detectors/grounding_dino.py CHANGED
@@ -62,25 +62,19 @@ class GroundingDinoDetector(ObjectDetector):
62
  return self.processor.post_process_grounded_object_detection(
63
  outputs,
64
  input_ids,
65
- box_threshold=self.box_threshold,
66
  text_threshold=self.text_threshold,
67
  target_sizes=target_sizes,
68
  )
69
  except TypeError:
70
- try:
71
- return self.processor.post_process_grounded_object_detection(
72
- outputs,
73
- input_ids,
74
- threshold=self.box_threshold,
75
- text_threshold=self.text_threshold,
76
- target_sizes=target_sizes,
77
- )
78
- except TypeError:
79
- return self.processor.post_process_grounded_object_detection(
80
- outputs,
81
- input_ids,
82
- target_sizes=target_sizes,
83
- )
84
 
85
  def _parse_single_result(self, processed) -> DetectionResult:
86
  boxes = processed["boxes"].cpu().numpy()
 
62
  return self.processor.post_process_grounded_object_detection(
63
  outputs,
64
  input_ids,
65
+ threshold=self.box_threshold,
66
  text_threshold=self.text_threshold,
67
  target_sizes=target_sizes,
68
  )
69
  except TypeError:
70
+ # Older transformers versions used box_threshold
71
+ return self.processor.post_process_grounded_object_detection(
72
+ outputs,
73
+ input_ids,
74
+ box_threshold=self.box_threshold,
75
+ text_threshold=self.text_threshold,
76
+ target_sizes=target_sizes,
77
+ )
 
 
 
 
 
 
78
 
79
  def _parse_single_result(self, processed) -> DetectionResult:
80
  boxes = processed["boxes"].cpu().numpy()
utils/tracker.py CHANGED
@@ -360,7 +360,7 @@ class STrack:
360
 
361
  class ByteTracker:
362
  def __init__(self, track_high_thresh=0.3, track_low_thresh=0.1,
363
- new_track_thresh=0.4, track_buffer=60, match_thresh=0.8,
364
  frame_rate=30, min_hits=3):
365
  STrack.reset_count()
366
  self.track_high_thresh = track_high_thresh
 
360
 
361
  class ByteTracker:
362
  def __init__(self, track_high_thresh=0.3, track_low_thresh=0.1,
363
+ new_track_thresh=0.3, track_buffer=60, match_thresh=0.8,
364
  frame_rate=30, min_hits=3):
365
  STrack.reset_count()
366
  self.track_high_thresh = track_high_thresh