feat: live count worker, tracking, and page updates
This commit is contained in:
1 parent
4606c0adeb
commit
1403a07b86
5 files changed
+77
-15
No files matched your search
@@ -25,6 +25,7 @@ DEFAULTS = {
|
||||
"entry_travel_min": 60.0, "handoff_radius": 100.0,
|
||||
"unload_confirm_frames": 3, "min_area_scale": 1.0,
|
||||
"dedup_radius": 60.0, "spatial_dedup": False,
|
||||
"count_classes": ["sack"],
|
||||
}
|
||||
|
||||
|
||||
@@ -176,7 +177,8 @@ def count_video(path: str, model, params: dict, should_cancel=None,
|
||||
raise CountingBenchError(f"Could not open {path}")
|
||||
total_frames = int(capture.get(cv2.CAP_PROP_FRAME_COUNT) or 0)
|
||||
|
||||
tracker = ByteTrackTracker(model, settings["conf"])
|
||||
tracker = ByteTrackTracker(model, settings["conf"],
|
||||
class_filter=tuple(settings["count_classes"]))
|
||||
stabilizer = BboxStabilizer(ema_alpha=0.35, max_hold_frames=10,
|
||||
max_height_ratio=1.5, min_height_ratio=0.70)
|
||||
counter = LineCrossCounter(
|
||||
@@ -199,7 +201,8 @@ def count_video(path: str, model, params: dict, should_cancel=None,
|
||||
if not ok or frame is None:
|
||||
break
|
||||
frame = cv2.resize(frame, (1280, 720))
|
||||
detections = [d for d in tracker.update(frame, []) if d.class_name == "sack"]
|
||||
# The tracker only emits count_classes, so no post-filter is needed.
|
||||
detections = tracker.update(frame, [])
|
||||
stable = stabilizer.update(detections)
|
||||
inside = [
|
||||
d for d in stable
|
||||
|
||||
Reference in new issue
Block a user