forked from andrew/feedmill-recounter
sync: mirror platform counting params (stabilizer hold, track_buffer, tracker iou)
- stabilizer max_hold 10 -> 25 frames (~1s occlusion hold, platform parity) - cfg/tracker.yaml track_buffer 60 -> 90 (identical to platform now) - ByteTrackTracker gains iou=0.7 (passed to model.track, platform parity) - stabilizer/tracking modules now byte-identical to karung_counter_semarang - 177 tests pass
This commit is contained in:
1 parent
89a265c54c
commit
37e2d3e296
5 files changed
+10
-8
No files matched your search
+2
-2
@@ -1,5 +1,5 @@
|
||||
# Custom FastTrack config tuned for sack counting:
|
||||
# - track_buffer=60: hold lost tracks for 60 frames (~2.4s at 25fps)
|
||||
# - track_buffer=90: hold lost tracks for 90 frames (~3.6s at 25fps)
|
||||
# to survive worker occlusion
|
||||
# - new_track_thresh=0.3: harder to spawn duplicate IDs
|
||||
# - track_low_thresh=0.05: recover faint detections behind workers
|
||||
@@ -11,7 +11,7 @@ tracker_type: bytetrack
|
||||
track_high_thresh: 0.20
|
||||
track_low_thresh: 0.05
|
||||
new_track_thresh: 0.30
|
||||
track_buffer: 60
|
||||
track_buffer: 90
|
||||
match_thresh: 0.85
|
||||
fuse_score: true
|
||||
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ roi:
|
||||
|
||||
stabilizer:
|
||||
ema_alpha: 0.35
|
||||
max_hold: 10 # frames to hold occluded tracks
|
||||
max_hold: 25 # frames to hold occluded tracks (platform parity: 25 = ~1s @25fps)
|
||||
|
||||
pipeline:
|
||||
detect_interval: 1 # detection+tracking every N frames (1 = every frame, most accurate)
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ DEFAULTS: dict = {
|
||||
},
|
||||
"stabilizer": {
|
||||
"ema_alpha": 0.35,
|
||||
"max_hold": 10,
|
||||
"max_hold": 25,
|
||||
},
|
||||
"pipeline": {
|
||||
"detect_interval": 1,
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@ Addresses four occlusion/flickering problems:
|
||||
1. Bbox jitter: raw detections jump 10-50px between frames.
|
||||
Fix: EMA (exponential moving average) on bbox coordinates.
|
||||
2. Bbox loss at line: worker's head/body blocks sack for 5-10 frames.
|
||||
Fix: hold last known smoothed bbox for `max_hold_frames` (10 frames).
|
||||
Fix: hold last known smoothed bbox for `max_hold_frames` (25 frames).
|
||||
3. Height expansion spike: worker body merges into sack bbox.
|
||||
Fix: clamp height expansion (`raw_h > smooth_h * max_h_ratio`).
|
||||
4. Height shrinkage collapse: worker head/shoulder covers bottom of sack.
|
||||
@@ -24,7 +24,7 @@ class BboxStabilizer:
|
||||
def __init__(
|
||||
self,
|
||||
ema_alpha: float = 0.35,
|
||||
max_hold_frames: int = 10,
|
||||
max_hold_frames: int = 25,
|
||||
max_height_ratio: float = 1.5,
|
||||
min_height_ratio: float = 0.70,
|
||||
) -> None:
|
||||
|
||||
+4
-2
@@ -6,7 +6,7 @@ Uses Ultralytics FastTrack which handles:
|
||||
- Re-identification of occluded tracks after reappearance
|
||||
|
||||
Our custom cfg/tracker.yaml tunes:
|
||||
- track_buffer=60 (hold lost tracks ~2.4s to survive worker occlusion)
|
||||
- track_buffer=90 (hold lost tracks ~3.6s to survive worker occlusion)
|
||||
- new_track_thresh=0.3 (prevent duplicate IDs from spawning)
|
||||
- active_occ_to_lost_thresh=15 (tolerate 15 occluded frames)
|
||||
"""
|
||||
@@ -28,7 +28,7 @@ _TRACKER_CFG = os.path.join(
|
||||
class ByteTrackTracker:
|
||||
"""Tracks sacks across frames using FastTrack (occlusion-aware)."""
|
||||
|
||||
def __init__(self, model_path: str | YOLO, conf: float = 0.35) -> None:
|
||||
def __init__(self, model_path: str | YOLO, conf: float = 0.35, iou: float = 0.7) -> None:
|
||||
if isinstance(model_path, YOLO):
|
||||
self._model = model_path
|
||||
self._model_path = getattr(model_path, "ckpt_path", str(model_path))
|
||||
@@ -36,6 +36,7 @@ class ByteTrackTracker:
|
||||
self._model = YOLO(model_path)
|
||||
self._model_path = model_path
|
||||
self._conf = conf
|
||||
self._iou = iou
|
||||
self._tracker_cfg = _TRACKER_CFG if os.path.exists(_TRACKER_CFG) else "bytetrack.yaml"
|
||||
|
||||
def update(
|
||||
@@ -45,6 +46,7 @@ class ByteTrackTracker:
|
||||
results = self._model.track(
|
||||
frame,
|
||||
conf=self._conf,
|
||||
iou=self._iou,
|
||||
persist=True,
|
||||
tracker=self._tracker_cfg,
|
||||
verbose=False,
|
||||
|
||||
Reference in new issue
Block a user